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

subcommand convenience wrapper doesn't work #25

Closed
casperdcl opened this issue Nov 28, 2020 · 5 comments · Fixed by #26
Closed

subcommand convenience wrapper doesn't work #25

casperdcl opened this issue Nov 28, 2020 · 5 comments · Fixed by #26
Assignees
Labels
p0-critical Max priority (ASAP)

Comments

@casperdcl
Copy link
Collaborator

shtab.add_argument_to(parser, "shell") # magic!
provides completion only for the subparser rather than the full (parent) parser

@casperdcl casperdcl added the p0-critical Max priority (ASAP) label Nov 28, 2020
@casperdcl casperdcl self-assigned this Nov 28, 2020
casperdcl added a commit that referenced this issue Nov 28, 2020
- fixes #25
- adds tests
@shcheklein
Copy link
Member

@casperdcl curious, what is the use case here, could you give an example please?

@casperdcl
Copy link
Collaborator Author

casperdcl commented Nov 29, 2020

basically the https://github.com/iterative/shtab/blob/a01e2b592102496a3a7b6861b448d0d6e78407f4/examples/customcomplete.py demo doesn't work - the generated completions only complete one subcommand (customcomplete completion ...) rather than the root command (customcomplete ...).

With #26 (correct convenience function), we can probably halve the number of lines in https://github.com/iterative/dvc/blob/master/dvc/command/completion.py

@shcheklein
Copy link
Member

so, DVC is not affected at the moment?

@casperdcl
Copy link
Collaborator Author

casperdcl commented Nov 29, 2020

no, not affected because it isn't (yet) using this convenience function. Merging #26 also won't affect dvc.

A PR in dvc can be made after merge to benefit.

@shcheklein
Copy link
Member

@casperdcl got it, thanks! 🙏 (that's why it was hard to get the idea, since I was trying it on the DVC and was not seeing any issues).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p0-critical Max priority (ASAP)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants