This provides a skeleton README for `clap_generate`, including a
one-line summary and a link to the docs to guide people to the examples
there.
In doing so, I tried to clarify and be consistent in what role
this crate plays. While it is very general, being too general in the
description can lead people to not understand where they could use it.
Fixes#1711
Following changes are implemented:
- Add 'clap::Arg::get_visible_aliases(&self)' method
This new method provides access to visible argument aliases
- Add 'clap::Arg::get_short/long_and_visible_aliases
This new method provides access to the short/long arguments and its
visible aliases
- Add visible aliases completions in clap_generate for following shells:
- Bash
- Elvish
- Fish
- Powershell
- Zsh
- Add test fixtures for testing visible alias completions in clap_generate:
'clap_generate/tests/completions/<shell>::<shell>_with_aliases()'
Right now, adjusting test cases to cover some special edge-cases for a
specific shell is a little problematic.
For instance, if you add a special character that needs escaping
to one of the help strings, not only the tests for the shell you're
currently working on need adjustments, but rather all shell tests!
Contributors can often only work on one specific shell. The
need to adjust shells they don't know anything about discourages
testing or makes it simply impossible for a single contributor.
Arguably, this commit introduces a lot of code duplication, but on
the other hand it also makes testing a lot easier.
the test that was added tests for a panic that would occur
when a global argument had a conflict with another argument
that wasn't present in all the subcommands that the global
argument was present in
this would occur inside the get_arg_conflicts_with function
zsh completion generation would panic if a global argument
had conflicts with another argument which was present in its
own command but not in its subcommands
Adds new method/attribute `Arg::value_hint`, taking a `ValueHint` enum
as argument. The hint can denote accepted values, for example: paths,
usernames, hostnames, commands, etc.
This initial implementation supports hints for the zsh and fish
completion generators, support for other shells can be added later.