Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function for pattern match file completion #69

Open
mauvilsa opened this issue Mar 3, 2022 · 0 comments
Open

Function for pattern match file completion #69

mauvilsa opened this issue Mar 3, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mauvilsa
Copy link

mauvilsa commented Mar 3, 2022

The example in https://github.com/iterative/shtab/blob/master/examples/customcomplete.py shows how to implement a completer for *.txt files. The example is good to show how to use custom shell specific functions. However, a completer for files that match a pattern can be considered a very common use case. It would be better to have a simpler way to support it. The shell specific details should be taken care internally by shtab and not burden the users with this. An idea could be something like the following:

parser.add_argument("--image").complete = shtab.file_completer(["*.jpg", "*.png"], ignore_case=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants