-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
use shtab for shell autocompletion #108
Comments
It is true that the current autocompletion is not as good as I would like it. In fact without considering speed or different shells support, it does not work for advanced features such as the subclasses. Though just because Another issue is that |
shtab works in a different way than autocompletion. It generates shell completion functions directly for the user and user should move the functions to fpath. Once the completing functions was generated, the complementary stuff is done through the shell. I just use it with LightningCLI. I modified the parser like here and I can generate
Yes, it partly can. See the examples they provide. Overall I think the completion needs to be done on the shell side rather than the python side because there will be complex parsers like LightningCLI and then it's hard to guarantee performance and generality. |
I have also arise a disscusion here Lightning-AI/pytorch-lightning#10858 |
Interesting. But then |
Yes, I think jsonargparse can be integrated it by default or through options. Or easy for jsonargparse to add subclasses and type hints. I am not really familiar with jsonargparse or shitab and am not sure where this should be done or downstream like LightningCLI. As a PytorchLightning user I'm just sharing my findings to see if there's anything you can enhance jsonargparse with shitab 😄 |
Yes should be fine... Just one line from https://docs.iterative.ai/shtab/use/#library-usage should suffice: shtab.add_argument_to(parser, ["-s", "--print-completion"]) Just to confirm:
|
@mauvilsa Hi, I found something should be down in jsonargparse: shtab use option type to decide completion nargs format in this line, however |
I have created two issues in the shtab repo which summarize what is needed for jsonargparse to implement the same features when used with shtab as with argcomplete. These are: |
In jsonargparse v4.30.0 now there is an experimental native |
Hi, I found argcomplete is slow and doesn't work well with zsh. Could you consider use shtab for shell completition.
The text was updated successfully, but these errors were encountered: