Commit graph

64 commits

Author SHA1 Message Date
Pavan Kumar Sunkara
3c9cc0cf91 Specify dep patch versions 2021-04-11 10:38:13 +01:00
Ajeet D'Souza
401744e24b Remove old slice syntax 2021-04-08 17:10:17 +05:30
Ajeet D'Souza
34fb411965 Use str:has-prefix in place of has-prefix 2021-04-08 16:51:06 +05:30
dalance
35c3814419 Add PathBuf to clap_generate::generate_to 2021-04-06 11:18:41 +09:00
Pavan Kumar Sunkara
4e3b4589ee
Merge pull request #2411 from clap-rs/upgrader
Cleanup and add changelog
2021-03-14 14:00:16 +05:30
Pavan Kumar Sunkara
d9fb11eba2 Apply cargo-intraconv 2021-03-13 14:11:47 +05:30
Pavan Kumar Sunkara
49954c28ad Remove unstable feature flag 2021-03-13 11:40:56 +05:30
Logan SQUIREL
d30a00e518
Make clap_generate::shell mod private 2021-03-11 11:13:31 +01:00
Logan SQUIREL
66f100f533
Improve clap_generate::Shell implementations 2021-03-11 10:56:44 +01:00
Logan SQUIREL
6a4cc8f9dd
api: Add clap_generate::Shell enum 2021-03-11 10:56:44 +01:00
ldm0
886b873709 Demangle interlinking flags 2021-03-09 13:45:11 +00:00
Jan Verbeek
7bb2795706 fix: Do not look for subcommands in fish completion if none exist 2021-02-22 15:35:07 +01:00
Logan SQUIREL
f74af655ce
Apply @pksunkara review 2021-02-22 09:37:29 +01:00
Logan SQUIREL
22b5d34693
imp: Visible aliases for arguments in completions (#2335)
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()'
2021-02-22 09:36:08 +01:00
ldm0
580d8d2c63 Fix part of the non_fmt_panic 2021-02-12 17:35:15 +00:00
Pavan Kumar Sunkara
1bd902370a Add tests for mut_arg on help and version 2021-02-07 15:54:24 +00:00
Pavan Kumar Sunkara
c9cb22905c Build help and version args at the beginning 2021-02-07 14:46:38 +00:00
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