Then you can also use a simple, built-in, declarative DSL to gradually enhance the robustness of your CLI by adding more checks or constraints, or use "parameter sets" [1] to define which parameters can and cannot be used together — tab completion will behave accordingly and suggest only what's allowed.
Dynamic completers, like mentioned in the article, can also be done [2].
[0] https://learn.microsoft.com/en-us/powershell/scripting/learn...
[1] https://learn.microsoft.com/en-us/powershell/module/microsof...
[2] https://learn.microsoft.com/en-us/powershell/module/microsof...
When I added tab completion for --model that accounts for what --agent is set to, it made it 100x easier to use and I stopped relying on the defaults so much.
It's such a small thing but makes a big difference for discoverability.
consider following
- git -> [ -C, <sub-commands> ]
- <sub-commands> -> [ add, branch, checkout, clone, remote, stash ]
- -C -> [ <directories> ]
- add -> [ <files>, <directories ]
...
- checkout -> [ <refs>, <files>, <directories> ]
---
obviously you could dump all these at every <tab> invocation, i usually create base+completions script considering completions for the base.
this way, i have tools & tools-completion, tools have sub-commands of fix, restart, connect, review, retrieve, etc.
each of these also have completions, like tools-restart-completions. those lists available services/daemons only
while installing, you only need to install "tools completions", that handles the redirect(s) to sub-commands and their sub-commands, making things easier to maintain, simple to operate, and independent.