|
1 | 1 | import os |
| 2 | +import pathlib |
2 | 3 | import typing as t |
3 | 4 |
|
4 | 5 | from libtmux.server import Server |
@@ -38,22 +39,22 @@ def __init__( |
38 | 39 | directories: bool = False, |
39 | 40 | **kwargs: object |
40 | 41 | ): |
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) |
49 | 48 |
|
50 | 49 | 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) |
54 | 51 |
|
55 | 52 | 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 | + ] |
57 | 58 | ) |
58 | 59 |
|
59 | 60 | return completion |
|
0 commit comments