Skip to content

Commit c62a348

Browse files
committed
tmuxp load <tab> that actually works
1 parent f059341 commit c62a348

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/tmuxp/cli/completions.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import pathlib
23
import typing as t
34

45
from libtmux.server import Server
@@ -38,22 +39,22 @@ def __init__(
3839
directories: bool = False,
3940
**kwargs: object
4041
):
41-
if isinstance(allowednames, (str, bytes)):
42-
allowednames = [allowednames]
43-
44-
self.allowednames = [x.lstrip("*").lstrip(".") for x in allowednames]
45-
self.directories = directories
46-
# super().__init__(
47-
# self, allowednames=allowednames, directories=directories, **kwargs
48-
# )
42+
# assert not isinstance(allowednames, (str, bytes))
43+
#
44+
# self.allowednames = [x.lstrip("*").lstrip(".") for x in allowednames]
45+
# self.directories = directories
46+
# # Does not work, unknown why
47+
super().__init__(allowednames=allowednames, directories=directories, **kwargs)
4948

5049
def __call__(self, prefix: str, **kwargs):
51-
completion: t.List[str] = argcomplete.completers.FilesCompleter.__call__(
52-
self, prefix, **kwargs
53-
)
50+
completion: t.List[str] = super().__call__(prefix, **kwargs)
5451

5552
completion.extend(
56-
[os.path.join(config_dir, c) for c in config.in_dir(config_dir)]
53+
[
54+
# os.path.join(config_dir, c).replace(str(pathlib.Path.home()), "~")
55+
pathlib.Path(c).stem
56+
for c in config.in_dir(config_dir)
57+
]
5758
)
5859

5960
return completion

0 commit comments

Comments
 (0)