Commit graph

82 commits

Author SHA1 Message Date
Ed Page
6c6b97daa8 docs: Ensure all crates have license files
In #2270, its brought up to solve this at the `cargo workspace publish`
level.  However, copying the files is a 5s fix without any design work,
it doesn't seem like support within an external tool should block us
from getting this fix into users hands.  Once `cargo workspace publish`
supports this and if we are still using it, we can re-evaluate.

Fixes #2270
2021-10-04 14:45:31 -05:00
cherryblossom
f77dceaf69
Fix Elvish completions generation
The `display-suffix` option for `edit:complex-candidate` was [deprecated in Elvish v0.14.0][1] and
removed in v0.15.0 (latest version is v0.16.3), so this commit changes the Elvish completions
generation to use the `display` option instead.

Additionally, this commit changes assignments to use the `var` and `set` keywords as using
`name = value` without these keywords ('legacy assignment form') [will be deprecated][2].

[1]: https://elv.sh/blog/0.14.0-release-notes.html
[2]: https://elv.sh/ref/language.html#legacy-assignment-form
2021-09-24 22:29:05 +10:00
Roland Fredenhagen
5580e8c465
ArgValue builder (#2758)
* feat(arg_value): ArgValue can be used for possible_values

Through the ArgValue it is possible:

* `hide` possible_values from showing in completion, help and validation
* add `about` to possible_values in completion

* Resolved a few change-requests by epage

* make clippy happy

* add ArgValue::get_visible_value

* remove verbose destructering

* rename ArgValue::get_hidden to ArgValue::is_hidden

* add test for help output of hidden ArgValues

* Documentation for ArgValue

There is an issue that required to implement From<&ArgValue> for
ArgValue. We should probably find a solution without that.

* fix requested changes by epage

* fix formatting

* add deref in possible_values call to remove From<&&str>

* make clippy happy

* use copied() instad of map(|v|*v)

* Finishing up for merge, hopefully

* changes requested by pksunkara
2021-09-19 10:29:09 +00:00
Roland Fredenhagen
c01df8da40
doc(generate) fix link in generate_to 2021-09-09 13:04:01 +02:00
Roland Fredenhagen
0105e6f0b8
fix(generate): Better subcommand completion in fish (#2726)
* fix(generate): Better subcommand completion in fish

* Prevent completing subcommands that were already completed

* Make sure all parent subcommands actually existent

Partially fixes #2715

* Added Test

* fix(generate) Improve subcommand testing

This now also disables the completion of sub_subcommands options for
subcommands.
2021-09-08 15:32:26 +01:00
ModProg
f6ccf07de4 Fix Formatting 2021-08-21 01:00:51 +02:00
ModProg
174e004107 fix(generate): Hide option/argument description for argenum
This returns `"{a\t,b\t}"` instead of `"a b"` for possible_values
completion. Therefore fish displays and therefor hides the empty
description after the `\t`.

Fixes #2727
2021-08-21 00:53:10 +02:00
Ed Page
f2586c920f docs: Point out alternatives to 'build.rs' 2021-08-18 12:10:04 -05:00
Ed Page
13a93ab671 docs(generate): Improve jumping off points
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
2021-08-18 12:10:04 -05:00
Donough Liu
b1d364a228
Pin clap_derive version (#2706)
* Pin clap_derive version

* Pin clap version in clap_generate
2021-08-17 08:43:37 +00:00
Pavan Kumar Sunkara
52be134949 Release 3.0.0-beta.4
clap@3.0.0-beta.4
clap_derive@3.0.0-beta.4
clap_generate@3.0.0-beta.4

Generated by cargo-workspaces
2021-08-14 23:40:49 +01:00
Pavan Kumar Sunkara
73b28fb104 Release 3.0.0-beta.3
clap@3.0.0-beta.3
clap_derive@3.0.0-beta.3
clap_generate@3.0.0-beta.3

Generated by cargo-workspaces
2021-08-14 23:01:13 +01:00
Pavan Kumar Sunkara
6994be4f15 Remove doc feature 2021-07-30 22:49:11 +01:00
patrick-gu
a4dc72ed19 Replace "Prints" with "Print" for default help and version commands 2021-07-29 20:23:25 -07:00
Tshepang Lekhonkhobe
b4eddf158d fix remaining intra-doc links 2021-07-10 21:00:34 +02:00
Rémi Lauzier
48147d680b
Update dependency that need no change 2021-06-17 13:58:40 -04:00
Rémi Lauzier
c4f534228b
Fix some nightly clippy warnings 2021-06-16 23:25:13 -04:00
Pavan Kumar Sunkara
94ce18c399 Update badges 2021-05-25 23:19:32 +01:00
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