kislyuk / argcomplete

Python and tab completion, better together.
https://kislyuk.github.io/argcomplete/
Apache License 2.0
1.39k stars 129 forks source link

how to use FilesCompleter from a base dir #368

Closed nadavhalahmi closed 2 years ago

nadavhalahmi commented 2 years ago

for example: parser.add_argument('--file').completer = FilesCompleter('/home') will show all directories/files in /home

evanunderscore commented 2 years ago

I don't believe this is a supported feature of FilesCompleter; it only seeks to replicate ordinary command line file completion, either absolute or relative to the working directory. If you want to complete filenames from a specific directory, you will need to either modify the completer or implement your own as a custom completer.