Comments (3)
I don't think there is currently a great way to do that. That definitely something that would be nice, if someone wants to give it a try!
For now, in our private application, we are completing with both the directory name and the directory name with a trailing slash:
$ myapp d<tab>
dir1
dir1/
dir2
dir2/
because there are two entries that begin exactly the same, the completion is done up to the full dir name, without the slash, and without space, so it is possilbe to continue the completion process.
Obviously the drawback is that the completion list is polluted by twice the amount of entries…
from click-completion.
Ah, nice workaround, thanks! Will use that for now.
from click-completion.
Hi @makkus and @glehmann , could you give a more complete example on how def complete ..
is used to perform filename completion?
I use the fish shell and the autocompletion is currently useless to me since filenames are not completed :/
p.s. It seems that
from glob import glob
import click
complete_filenames = click.Choice(glob("**", recursive=True))
...
@click.argument("filename", type=complete_filenames)
...
does the job for me. Anyway if you have other suggestions, please let me know. Thanks!
p.p.s it does only when the directory tree is too large.
p.p.p.s this seems to be sufficient and doesn't require glob
or anything:
complete_filenames = click.Path(exists=True)
p.p.p.p.s. only on fish
2.2.0 though, I noticed. I tried to understand changes in the fish completion
API after 2.2.0, but did not come too far until now. Any ideas?
from click-completion.
Related Issues (20)
- zsh completion with "inner" substrings HOT 2
- setup.py relies on old-style extras syntax
- Please tag 0.5.0 HOT 1
- Install fails when running PowerShell from emulated terminal cmder
- Don't suggest hidden commands HOT 1
- zsh: command not found: #compdef HOT 2
- psutil remains should be removed HOT 1
- file/path completion HOT 3
- 'install_requires' must be a string or list of string HOT 3
- Don't suggest hidden options
- No completion for choices with whitespace. HOT 1
- Not working for options defined for comma separated values
- Problem with completion HOT 3
- Click's completion system has been rewritten HOT 1
- No support for PowerShell 7 (PowerShell Core)
- Clarify whether this repo is deprecated or not HOT 5
- How to run install command after pip install ? HOT 1
- click 8.0 compatible code? HOT 3
- Publish "wheel" package in PyPI
- How to apply part of this library to support Powershell completion for click v8.x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from click-completion.