Commit graph

47 commits

Author SHA1 Message Date
Arne Beer
f290a9de72 Code formatting and completion script formatting 2020-12-28 01:41:57 +01:00
Arne Beer
915d60504c zsh: Test subcommand help text escaping 2020-12-28 01:41:57 +01:00
Arne Beer
9001bf5d21 zsh: Fix subcommand help escaping 2020-12-28 01:41:57 +01:00
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
Donough Liu
2f9846d048 Lazy subcommand propagation, avoid redundant _build() function call
rustfmt and clippy

Indepth cleaning

Apply suggestions
2020-12-12 22:32:20 +08:00
Pavan Kumar Sunkara
b89163afb6 Update MSRV to 1.46 2020-11-28 11:58:28 +00:00
hk
895c903b61 refactor: adding get_global, making two functions private
preserving the observable behavior of the existing 
public api, while handling global arguments separately in 
get_arg_conflicts_with
2020-11-09 15:29:00 +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
hk
1b451f62ad fix(clap_generate): zsh completion generation panic
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
2020-10-30 21:04:17 +01:00
Pavan Kumar Sunkara
d6e2246aab Rename setting DisableVersion => DisableVersionFlag 2020-10-24 16:03:12 +02:00
Yaroslav Bolyukin
ea304e4607
clap_generate skips flags/opts with heading
Follow-up issue #2022

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
2020-10-19 20:55:07 +05:00
Marti Raudsepp
bc7cc4fbab Add examples for using value_hint with clap_derive
Also tweaked clap_generate example a little.
2020-10-10 00:11:44 +03:00
Pavan Kumar Sunkara
d881a1185b Release 3.0.0-beta.2
clap@3.0.0-beta.2
clap_derive@3.0.0-beta.2
clap_generate@3.0.0-beta.2

Generated by cargo-workspaces
2020-09-18 20:32:41 +02:00
Pavan Kumar Sunkara
55abd639f7 Rename get_*_no_heading to get_*_with_no_heading 2020-08-29 11:49:04 +02:00
Alex M
60dfcf13b5 Allow for nested subcommands with ZSH generation. 2020-08-23 09:33:29 -07:00
aspen
96b7fd454b
Forbid all unsafe code. 2020-08-20 18:38:40 -04: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
Nicholas Nethercote
217b111bd7 refactor: Replace it.find(...).is_none() with !it.any(...). 2020-07-29 10:35:22 +10:00
CreepySkeleton
37c1631f06 Make lifetimes descriptive 2020-07-21 18:59:07 +03:00
bors[bot]
aab97614ed
Merge #2020
2020: Implementation of feature request #1918 r=pksunkara a=leo-lb



Co-authored-by: Léo Le Bouter <lle-bout@zaclys.net>
2020-07-21 09:47:23 +00:00
Léo Le Bouter
eabe8b67b4 Implementation of feature request #1918 2020-07-20 15:35:40 +02:00
Marti Raudsepp
594c535ba2 Fix various typos in docs & code
Most errors detected and fixed with Topy (https://github.com/intgr/topy),
all verified by hand.
2020-07-19 03:10:28 +03:00
CreepySkeleton
7e8d120543 Make getters return iterators rather than slices 2020-07-06 17:33:02 +03:00
CreepySkeleton
f904bebd9a Ditch find_subcnd*! and match_alias! 2020-06-27 04:30:02 +03:00
CreepySkeleton
b7be22e90b Ditch opts! and positionals! 2020-06-27 04:30:01 +03:00
CreepySkeleton
f46af5b96b Ditch flags! 2020-06-27 04:30:01 +03:00
Pavan Kumar Sunkara
1a276f8f4f Remove Arg::help 2020-06-10 09:34:55 +02: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
Pavan Kumar Sunkara
b562ce4d63 Some modifications to allow cargo verification to work 2020-05-03 11:48:01 +02:00
creativcoder
92d5920748 Updated test and usage of older help APIs with about 2020-04-27 02:42:07 +05:30
creativcoder
75f5a9ab62 Code review p1 2020-04-27 02:42:07 +05:30
creativcoder
24cb8b13c5 Deprecate Arg::help in favour of Arg::about 2020-04-27 02:42:07 +05:30
Pavan Kumar Sunkara
f0074752b9 Improve debug logs 2020-04-22 20:56:35 +02:00
Pavan Kumar Sunkara
070bd50b28 Finished color refactor 2020-04-16 12:51:26 +02:00
CreepySkeleton
7cff206194 Make all fields of App & Arg pub(crate) 2020-04-11 18:23:20 +03:00
Pavan Kumar Sunkara
b45746feff Remove some defaults from profiles 2020-04-10 17:19:26 +02:00
Pavan Kumar Sunkara
cceb29623a Remove nightly feature 2020-04-10 10:42:25 +02:00
CreepySkeleton
5d9ef1527f Fix warnings in tests & examples 2020-03-05 13:40:25 +03:00
CreepySkeleton
d466a56aa1 Fix benches 2020-03-04 21:31:18 +03:00
quake wang
bb4a6df5ba fix: bash completions with app name which contains - 2020-03-01 23:35:49 +01:00
CreepySkeleton
4f13f3155c Fix warnings on nightly 2020-02-21 01:55:19 +03:00
Pavan Kumar Sunkara
970d7140a3 Use 'Clap Maintainers' as authors 2020-02-10 20:16:25 +01:00
Ole Martin Ruud
da7e9e5505 Escape colon in zsh completion help 2020-02-07 07:52:04 +01: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