Commit graph

12 commits

Author SHA1 Message Date
Arne Beer
84d99d6bb8 Give each shell test their own App
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.
2020-12-28 01:40:15 +01:00
Arne Beer
6f930379cc Put completion tests for different shells in submodules 2020-12-27 20:47:30 +01:00
hk
3923ebd86d tests(clap_generate): zsh completion generation bug
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
2020-10-30 21:23:35 +01:00
Pavan Kumar Sunkara
d6e2246aab Rename setting DisableVersion => DisableVersionFlag 2020-10-24 16:03:12 +02:00
Alex M
60dfcf13b5 Allow for nested subcommands with ZSH generation. 2020-08-23 09:33:29 -07:00
Marti Raudsepp
64ee0f8009 Add hinting of arg value types for zsh/fish completion
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.
2020-08-06 22:17:31 +03:00
Pavan Kumar Sunkara
7bc282dd4e Rename with_name to new for Arg & ArgGroup 2020-05-14 22:50:56 +02:00
Josh Holland
5948754d2f fix(completions): improve correctness of completions when whitespace is involved
compgen takes exactly one "word" argument; if multiple are passed, it
will ignore all but the first. If `$cur` is not quoted and contains
whitespace, it will be expanded into multiple words, so the completions
will be based only on the first word of `$cur`, which is clearly not
correct.

To fix this, quote `$cur` to prevent word splitting, where necessary
(Bash does not perform word splitting inside the extended test command
`[[`, so quotes aren't necessary there).
2020-05-12 01:32:15 +02:00
creativcoder
92d5920748 Updated test and usage of older help APIs with about 2020-04-27 02:42:07 +05:30
CreepySkeleton
5d9ef1527f Fix warnings in tests & examples 2020-03-05 13:40:25 +03:00
Pavan Kumar Sunkara
e6f77a8713 Added helper methods to generator 2020-02-07 07:52:04 +01:00
Pavan Kumar Sunkara
33f47acc67 Refactor clap_generate 2020-02-07 07:52:04 +01:00