Tab completion for CLI
See original GitHub issueI was going to toy around with adding powershell or bash tab completion for my app, but it occurred to me that it might be possible (and maybe even easier) to bake this in. I’d
The way some tools work is they provide something like a completion
command that accepts the list of currently typed arguments (e.g. if I was typing git checkout sp[tab]
it would run git completion checkout sp
and the application would supply the tab information.
My Saturday night plan for investigation the feasibility would be for simple things like enums and bools to automatically return the valid values. But for strings it would work like ParameterValidationAttribute
where you could have
public abstract CompletionResult Complete(ICommandParameterInfo info, object? value);
And you’d mark up your settings appropriately. You’d want services to be injected though. TBH I’m not sure if the validation code allows that as is.
Reading
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:9 (6 by maintainers)
Top GitHub Comments
@Jawz84 Great! Feel free to open a PR before finishing it so that we can have a continuous discussion.
Absolutely. Lets use this to brainstorm some scenarios and go from there. My little guy is stealing a ton of my time so extended coding sessions are a rarity so being able to assist would be great
I’ll try and come up with a few more test ideas to drive this tonight