Commit graph

1864 commits

Author SHA1 Message Date
Pavan Kumar Sunkara
9c99c358c6
Merge pull request #2440 from reaganmcf/app-setting-subcommand-help-long-form
setting: UseLongFormatForHelpSubcommand
2021-04-13 04:42:51 +05:30
Reagan McFarland
b184dc001b setting: SubcommandHelpShowsLongForm implemented
Refactoring and better test cases

Refactored SubcommandHelpShowsLongForm to
UseLongFormatForHelpSubcommand.
Tests and docuemntation examples use about and long_about instead of
(before/after)_help.

Removed commented out tests

Linting: Fix trailing new line

Updated change log, refactored tests and doc str

Reordered items in the Changelog
New test added and old tests removed that were redundant
Doc string for AppSettings::UseLongFormatForHelpSubcommand fixed
2021-04-11 14:31:40 -04:00
Pavan Kumar Sunkara
3c9cc0cf91 Specify dep patch versions 2021-04-11 10:38:13 +01:00
Pavan Kumar Sunkara
52814b893c
Merge pull request #2415 from cbzehner/ignore-extra-fields-on-arg
Ignore extra fields in Arg yaml definitions
2021-03-14 14:00:30 +05:30
Pavan Kumar Sunkara
4e3b4589ee
Merge pull request #2411 from clap-rs/upgrader
Cleanup and add changelog
2021-03-14 14:00:16 +05:30
Chris Zehner
407e629523 Ignore extra fields in Arg yaml definitions 2021-03-13 19:46:38 -06:00
Pavan Kumar Sunkara
d9fb11eba2 Apply cargo-intraconv 2021-03-13 14:11:47 +05:30
Pavan Kumar Sunkara
f029047c03 Rename NoEmptyValues to ForbidEmptyValues 2021-03-13 12:05:34 +05:30
ldm0
d36b201fd6 Apply suggestions 2021-03-11 05:22:08 +00:00
ldm0
a1d4bd8488 Allow empty value by default, introduce NoEquals Error 2021-03-10 17:39:50 +00:00
Pavan Kumar Sunkara
30d784ffd1
Merge pull request #2400 from ldm0/unset-default
Support unsetting/removing the default if an option/flag is set
2021-03-10 18:13:52 +05:30
ldm0
448ff95fb0 ldm0's patch 2021-03-09 19:06:44 +00:00
Steven Engler
766dec8319 fixup! feat(build/arg/mod.rs): default_vals_if supports an Option as the default 2021-03-09 18:15:20 +00:00
Steven Engler
6626365359 feat(build/arg/mod.rs): default_vals_if supports an Option as the default 2021-03-09 18:15:20 +00:00
ldm0
2b0f0d3e1a Implement NoEquals error 2021-03-09 17:56:57 +00:00
Pavan Kumar Sunkara
42c03775b5
Merge pull request #2395 from loloicci/improve-doc-error-exit
Improve the document of exit of parse::Errors
2021-03-09 23:20:04 +05:30
loloicci
06c2187f9e docs: improve the document of exit of parse::Error 2021-03-09 23:37:45 +09:00
ldm0
0b1d137ee9 Apply suggestions 2021-03-09 13:52:12 +00:00
ldm0
6df56ad289 Move checker to macro(better panic message) 2021-03-09 13:45:11 +00:00
ldm0
886b873709 Demangle interlinking flags 2021-03-09 13:45:11 +00:00
ldm0
2bedad2bfa Split debug_asserts from Arg 2021-03-09 13:45:11 +00:00
loloicci
0a6f086b8e feat: implement print to parse::Error
Implement print to parse::Error.
It just prints formatted error messages and does not exit program.
2021-03-09 18:27:04 +09:00
Pavan Kumar Sunkara
09009761ec
Merge pull request #2368 from integer32llc/more-getters
Allow getting the long about, env, and default values of an argument
2021-03-05 22:53:28 +05:30
Jake Goulding
30840d6f35 Allow getting the long about, env, and default values of an argument
Closes #2367
2021-03-05 11:02:18 -05:00
Christoph Prokop
676a2d24b6 Fix code example to match help text
Signed-off-by: Christoph Prokop <christoph.prokop@mailbox.org>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Reviewed-by: Matthias Beyer <mail@beyermatthias.de>
2021-03-05 10:04:37 +01:00
dylni
8a6881169b Upgrade os_str_bytes 2021-03-01 17:58:53 -05:00
Omar El Halabi
701a4610b3 feat: Implement Arg::required_if_eq_all 2021-02-28 14:52:34 +02:00
Logan SQUIREL
3c049b4e22
Fix compatibility with help2man output (see #1432)
Change default help template:
- The new template introduce new lines before and after
author/about sections.
- Add help template placeholders:
    - about-section
    - author-section
- Documentation of new placeholders in clap::App::help_template
- Update all unit tests by incorporating new lines
2021-02-27 16:20:52 +01:00
Andreas Molzer
c6ea3720ab Optimize common case of space padding 2021-02-25 13:26:39 +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
Pavan Kumar Sunkara
1602b103cd
Fix typo in crate_license docs 2021-02-20 22:08:48 +00:00
Martin Geisler
df7a8c1282 feat: remove direct unicode-width dependency
This removes the direct dependency on unicode-width and delegates the
complexity of computing the displayed width of text to the Textwrap
crate.

The `display_width` function handles characters like “æøå” (Danish),
“äöü” (German), and “😂😍” (emojis) – even if the unicode-width
Cargo feature is disabled.

This is an improvement of the former `str_width` function which would
over-estimate the width of emojis and non-ASCII characters (since they
are several bytes wide).
2021-02-20 20:56:15 +01:00
Pavan Kumar Sunkara
80cbc1e695
Merge pull request #2350 from ldm0/num_vals
Change how num_vals, min_vals, max_vals interacts with Multiple*
2021-02-18 21:07:26 +00:00
ldm0
2d26f02605 Add --all-features for CI, fix build with debug feature. 2021-02-17 04:37:08 +00:00
ldm0
28b58af63b Change to num_vals, min_vals, max_vals interacts with Multi* 2021-02-16 03:45:20 +00:00
Collin Styles
2b45011c9b
Update docs for required_unless_present_any (#2347)
* docs: Correct method name in example

This looks like it was copied from the documentation for
`required_unless_present_all` but not updated accordingly for this
method.

* docs: Add note re `required_unless_present_all` to `required_unless_present_any`

There's a note in the documentation for `required_unless_present_all`
telling users to check out `required_unless_present_any` if that's what
they want. I figured it might be useful to have a similar note in the
documentation for `required_unless_present_any` pointing to that method
as well.

* docs: Fix `required` link in docs for `required_unless_present_all`

* docs: Correct "if" to "unless"
2021-02-15 08:20:11 +00:00
ldm0
73c682b652 Small code shrinking 2021-02-14 13:07:21 +00:00
ldm0
5cff16b6f9 Limit usage of inc_occurence_of 2021-02-14 11:21:12 +00:00
ldm0
78d7252b03 Remove Parser::need_more_vals 2021-02-14 11:21:12 +00:00
Pavan Kumar Sunkara
a8c9d28ead
Merge pull request #2346 from ldm0/non_fmt_panic_fix
Fix part of the non_fmt_panic warnings, bump version-sync to 0.9.2
2021-02-14 01:58:26 +00:00
Pavan Kumar Sunkara
5025ed3bee
Merge pull request #2345 from ldm0/usize
Change some u64 to usize
2021-02-14 01:57:53 +00:00
ldm0
ddb53af5dc Change some u64 to usize 2021-02-13 15:25:40 +00:00
ldm0
580d8d2c63 Fix part of the non_fmt_panic 2021-02-12 17:35:15 +00:00
Pavan Kumar Sunkara
6634444c3c Remove Arg::settings to be consistent with App 2021-02-12 10:42:38 +00:00
Pavan Kumar Sunkara
8eb5081b53 Update changelog 2021-02-10 23:33:14 +00:00
Pavan Kumar Sunkara
2b5a23597a Better help message support for hidden and heading stuff 2021-02-08 05:22:27 +00:00
Pavan Kumar Sunkara
3758bba5e2 Remove help_about in favor of mut_arg 2021-02-07 17:22:56 +00:00
Pavan Kumar Sunkara
b824e0b088 Allow nested subcommands mutated generated args to take preference 2021-02-07 16:28:49 +00:00
Pavan Kumar Sunkara
423e2dde00 Remove version_about in favor of mut_arg 2021-02-07 16:14:07 +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
93a737a4fa
Merge pull request #2333 from clap-rs/build_help_and_version_at_start
Build help and version args at the beginning
2021-02-07 15:53:45 +00:00
Pavan Kumar Sunkara
c9cb22905c Build help and version args at the beginning 2021-02-07 14:46:38 +00:00
ldm0
899b04f481 Remove clone 2021-02-07 05:40:02 +00:00
ldm0
1494109795 Apply rename suggestions 2021-02-07 05:32:35 +00:00
ldm0
fb3033834b Change the way parser do self override 2021-02-07 04:46:56 +00:00
Donough Liu
58b9f35771 Add tests, fix grouped_values_of()
Fix clippy

type complexity fix
2021-02-07 04:46:56 +00:00
Donough Liu
451c5382cc Finish arg grouping logic 2021-02-07 04:46:56 +00:00
Donough Liu
b48ccff812 Better MatchedArg::ty 2021-02-07 04:46:56 +00:00
Donough Liu
fdafa3f02a More convenient MatchesArg functions 2021-02-07 04:46:56 +00:00
Donough Liu
7782a5eefc Insert vals group for default missing vals 2021-02-07 04:46:56 +00:00
Donough Liu
32e03a0dfe Better flow 2021-02-07 04:46:56 +00:00
Donough Liu
f1e9b82584 Implement nested vals 2021-02-07 04:46:56 +00:00
Donough Liu
9c52e454e8 Refactor MatchedArg::vals 2021-02-07 04:46:56 +00:00
Donough Liu
18549df845 Refactor MatchedArg::indices 2021-02-07 04:46:56 +00:00
ldm0
1000c9fb03 Fix eagerly trimming dash in parse_long_flag 2021-02-06 11:26:20 +00:00
Donough Liu
00cf697d36 Small simplification on several functions 2021-02-05 10:07:46 +00:00
Donough Liu
5e020c636d Remove had_eq 2021-02-05 10:07:46 +00:00
Donough Liu
751adaa687 Remove ContainsLast flag 2021-02-05 10:07:46 +00:00
Donough Liu
818f62bd5c Unused clippy allow 2021-01-30 17:39:34 +00:00
Donough Liu
45753d552b Resolve a TODO 2021-01-30 17:39:34 +00:00
Donough Liu
cf4881182a Add comments for some internal app settings 2021-01-30 17:39:34 +00:00
Donough Liu
c8e669c690 Eliminate unreachable branch
comment fix

Apply fmt
2021-01-30 17:39:33 +00:00
Donough Liu
944fc759c9 Optimize branch, more comments 2021-01-30 17:24:11 +00:00
Donough Liu
5774eb2c52 Simplify possible subcommand 2021-01-30 17:24:11 +00:00
Donough Liu
9cf007378b Branch simpification 2021-01-30 17:24:11 +00:00
Donough Liu
336f926ec9 Integrate workflow 2021-01-30 17:24:11 +00:00
Donough Liu
be314d9ac0 Flow optimize 2021-01-30 17:24:11 +00:00
Donough Liu
c39dcf2ecf Remove redundant ClapResult in some functions 2021-01-30 17:24:11 +00:00
Donough Liu
1b63516e3b Flow reordering 2021-01-30 17:24:11 +00:00
Donough Liu
47eee8ab2f Acc a request 2021-01-30 17:24:11 +00:00
Donough Liu
c6bcfe819e Clearer error processing 2021-01-30 17:24:11 +00:00
Donough Liu
8f4c26fc58 Minor redundant logic cleanup
Fix clippy

dot fix
2021-01-30 17:24:09 +00:00
Pavan Kumar Sunkara
8d5a021e1e
Merge pull request #2309 from ldm0/parser0
Dehack, Revert #1856
2021-01-30 14:52:02 +00:00
ldm0
5ee6e07858 Fix usage of positional grouped arguments uses arg name rather than val_name 2021-01-24 19:02:43 +00:00
Donough Liu
0df169bbdc Fix incorrect error message.
Comment out regressed logic

Fix clippy
2021-01-23 14:51:40 +00:00
Donough Liu
90d786b8bc Dehack, revert #1856 2021-01-23 14:51:40 +00:00
Pavan Kumar Sunkara
d7f6748887
Merge pull request #2306 from ldm0/unset_setting
Fix unset_setting()
2021-01-23 13:37:57 +00:00
Bowen Ding
3907e11621
Make @group accept multiple attributes (#2248)
* Make @group accept multiple attributes.

* New syntax: remove parenthese and "=>".

* Fix example

* Make Clippy happy

* Make clippy happy again
2021-01-23 13:12:40 +00:00
ldm0
68a0ef930a Fix copied code 2021-01-23 06:41:11 +00:00
AriusX7
448c102f4f fix: allow visible alias(es) in yaml files 2021-01-20 02:17:17 +05:30
Pavan Kumar Sunkara
42a4087220
Merge pull request #2299 from ldm0/terminator
Pick up missing setting
2021-01-18 22:13:20 +00:00
Donough Liu
09f43594b9 Fix doc test 2021-01-19 02:39:16 +08:00
Donough Liu
acdb94c1a5 Add assert to make doc test fails. 2021-01-19 02:37:07 +08:00
Donough Liu
6968f340c3 Fix clippy warnings 2021-01-19 02:24:58 +08:00
Donough Liu
c6da968ec7 Bump textwrap to 0.13.2 2021-01-02 13:15:50 +08:00
Martin Geisler
72884b2642 docs: Mention correct default value in term_width docstring
The default was correctly changed to 100 in #1950, but later
accidentally reverted in 89fcc75.
2020-12-31 08:55:56 +01:00
Pavan Kumar Sunkara
a0269a41d4
Merge pull request #2268 from ldm0/fixme
Better mkeymap
2020-12-28 10:09:27 +00:00
Donough Liu
0f115f18ad Fix positional count usage 2020-12-27 04:11:30 +08:00
Donough Liu
120e942e7a Private arg 2020-12-27 01:46:48 +08:00
Donough Liu
2b7fd731ae Private keys 2020-12-27 01:20:53 +08:00
Donough Liu
f54328ee4c Cleaner api and better inner documentation 2020-12-27 00:43:49 +08:00
Donough Liu
53fdc9d6b2 Fix clippy 2020-12-26 21:03:21 +08:00
Donough Liu
ad3d3a13cd KeyType: PartialEq for u64 2020-12-26 21:03:21 +08:00
Donough Liu
b2a066b24f Resolve a fixme, better code readability 2020-12-26 21:03:21 +08:00
budde25
c26d1a4421 imp: added more derives to common App, Arg, and ArgMatches 2020-12-23 17:26:53 -06:00
budde25
52635f00d4 docs(arg_matches.rs): clarified unclear behavior for is_present and value_of methods 2020-12-23 07:44:19 -06:00
Pavan Kumar Sunkara
4bd15c45d2
Merge pull request #2253 from ldm0/global
Propagate global arg in subcommand to subsubcommand
2020-12-14 02:20:34 +00:00
Pavan Kumar Sunkara
c4ab996339
Merge pull request #2252 from ldm0/lazy_propagation
Lazy propagation and _build cleaning
2020-12-12 16:56:09 +00:00
Donough Liu
1965b9f866 Add BinNameBuilt flag to App 2020-12-13 00:11:12 +08: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
Donough Liu
fa9be84b18 Propagate global arg in subcommand to subsubcommand 2020-12-12 22:20:16 +08:00
Donough Liu
5f5474d803 Fix only one arg printed in multiple required_unless missing situation 2020-12-12 12:57:17 +08:00
Donough Liu
6fdad97a90 Remove unused flag 2020-12-10 00:58:11 +08:00
Donough Liu
e58f89b3ab Remove LowIndexMultiplePositional, stop repeatedly calc positional_count 2020-12-10 00:51:18 +08:00
Robin Moussu
6898fbde33 Automatically read license field from Cargo.toml 2020-12-09 00:16:19 +01:00
Donough Liu
573dc245e6 Fix incorrect error message. 2020-12-09 01:12:58 +08:00
Jonas Platte
041bfda7ca
Fix a typo in the Clap trait docs (#2243)
* Fix a typo in the Clap trait docs

* Update src/derive.rs

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-12-08 01:40:18 +00:00
Pavan Kumar Sunkara
3c93f276b5
Merge pull request #2230 from ahkrr/master
refactor: TODO 1.46.0, improve readability by using [] operator
2020-11-28 13:11:50 +00:00
Pavan Kumar Sunkara
c8184470ff
Merge pull request #2140 from ldm0/validator_fixme
Resolve a FIXME
2020-11-28 13:11:38 +00:00
Pavan Kumar Sunkara
b89163afb6 Update MSRV to 1.46 2020-11-28 11:58:28 +00:00
hk
bb7c9896b0 refactor: TODO 1.46.0, improve readability by using [] operator 2020-11-28 11:38:34 +01:00
Donough Liu
cad893ed04 Resolve a FIXME 2020-11-28 18:31:42 +08:00
arthmis
a97e24630d chore: changing unrequired to non-required 2020-11-27 15:37:26 -05:00
arthmis
1b4a4596f6 docs: fixing a typo 2020-11-27 15:19:03 -05:00
arthmis
4e6a371851 chore: changing awkward grammar for positional argument error message 2020-11-27 15:12:28 -05:00
Pavan Kumar Sunkara
d36d91173d
Merge pull request #2191 from ahkrr/master
fix(clap_generate): zsh completion generation panic
2020-11-26 18:36:41 +00:00
Pavan Kumar Sunkara
821d79aac7
Merge pull request #1878 from lu-zero/update_from_arg_matches
Add update_from_arg_matches to FromArgMatches
2020-11-14 12:38:16 +01:00
Luca Barbato
3e51839383 Rename the update trait methods 2020-11-14 10:58:30 +01:00
Luca Barbato
5d342a7438 Update to the new from_subcommand logic 2020-11-14 10:17:13 +01:00
Luca Barbato
a9276576d7 wip: Add a variant for augment* for updates 2020-11-14 10:17:13 +01:00
Luca Barbato
8b6255057d wip: Complete update_subcommand
external subcommand updating is equivalent to replace it
2020-11-14 10:17:13 +01:00
Luca Barbato
646b3fe811 wip: Add tests and user-facing functions 2020-11-14 10:17:13 +01:00
Luca Barbato
d1fc83a8fa wip: Add update_from_arg_matches to FromArgMatches 2020-11-14 10:17:13 +01: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
ldm0
ff3b23824d Fix wrong StrictUTF8 handling when AllowExternalSubcommands 2020-11-08 19:06:32 +00:00
Donough Liu
93b9bd9162 Apply suggestions 2020-11-08 23:06:24 +08:00
Donough Liu
407cdac8e0 Refactor: remove a persistent parser state ValidNegNumFound 2020-11-08 16:05:07 +08:00
Donough Liu
3c2f60c9f3 Remove unreachable branch in use_long_arg() 2020-11-08 16:05:07 +08:00
Donough Liu
7aa2358d6e Simplify is_new_arg() 2020-11-08 16:05:07 +08:00
Donough Liu
b1c7785810 Remove replace variable
Resolve TODO

Small refactors

More descriptive replaced item recovering
2020-11-08 16:05:03 +08:00
Donough Liu
5e4b4f4196 Remove invalid suggestion on using subcommand after positional argument 2020-11-07 20:32:28 +08:00
Donough Liu
2b1f47f975 Reduce osstring construction 2020-11-07 16:43:14 +08:00
Donough Liu
020b07b77b Typo fix 2020-11-07 16:43:14 +08:00
Donough Liu
582db739c8 Shrink 2020-11-07 16:43:14 +08:00
Donough Liu
f17b29acbb Make Arg::env() and Arg::env_os() takes_value(false) by default 2020-11-06 21:51:39 +01:00
hk
5650e37969 fix: compatability with rustc 1.42.0
fixup!
2020-11-05 13:08:04 +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
bors[bot]
97b4fb639f
Merge #2165
2165: Help & Version settings r=pksunkara a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-10-28 06:27:49 +00:00
Pavan Kumar Sunkara
5dd9584119 Improve the logic for help & version building & parsing 2020-10-26 12:13:03 +01:00
Donough Liu
a19bfa1c35 Consistently wrap help and subcommand messages(with refactoring) 2020-10-25 22:43:01 +01:00
KBR9
625c201f65 Add docs about conflicts_with_all usage in yaml
add note about conflicts_with yaml option

add note about conflicts_with yaml option

fix wrapping

remove unnecessary sentence

remove note from conflicts_with
2020-10-24 21:54:01 +02:00
Pavan Kumar Sunkara
e8a06e79cd Rename setting VersionlessSubcommands => DisableVersionForSubcommands 2020-10-24 16:04:49 +02:00
Pavan Kumar Sunkara
d6e2246aab Rename setting DisableVersion => DisableVersionFlag 2020-10-24 16:03:12 +02:00
Pavan Kumar Sunkara
45f0ee8b55 Rename setting DisableHelpFlags => DisableHelpFlag 2020-10-24 16:03:12 +02:00
CastilloDel
88ac1f1803 Add assertions for required and default simultaneously
Add the suggested changes

Fix test issue_1050_num_vals_and_defaults

It used a required which isn't needed for the purpose of the test.

Add tests for the default+required assertions

Add test for positional args with long or short
2020-10-24 12:10:07 +01:00
bors[bot]
1d0b21908f
Merge #2178
2178: Various documentation fixes r=pksunkara a=cstyles



Co-authored-by: Collin Styles <collingstyles@gmail.com>
2020-10-18 22:08:05 +00:00
Collin Styles
0d4e2e5f9d docs: remove links in documentation for requires_all
These links were broken but rather than fix them, let's just remove them
since they're inside the documentation for the function that they link
to which seems unnecessary.
2020-10-18 12:05:33 -07:00
Collin Styles
5b74d84f3c docs: remove links in documentation for requires_if functions
These links were broken but rather than fix them, let's just remove them
since they're inside the documentation for the functions that they link
to which seems unnecessary.
2020-10-18 12:05:32 -07:00
Collin Styles
3d5e1d987a docs: add a bunch of missing links to the docs for Arg::env 2020-10-18 12:05:31 -07:00
Collin Styles
ba89a253fc docs: remove link to allow_hyphen_values
This link was broken but rather than fix it, let's just remove it since
it's inside the documentation for the function that it links to which
seems unnecessary.
2020-10-18 12:05:30 -07:00
Collin Styles
8522b9c1cf docs: fix another typo and add a missing link for Last 2020-10-18 12:05:29 -07:00
Collin Styles
eadecc5c1d docs: add missing link in ArgGroup documentation 2020-10-18 12:05:28 -07:00
Collin Styles
096338d163 docs: correct typo in ErrorKind documentation 2020-10-18 12:05:27 -07:00
Collin Styles
75c1fdb707 docs: fix various copy-paste errors related to default_value functions 2020-10-18 12:05:26 -07:00
Collin Styles
f7837b2ac0 docs: change single quotes to backticks
Pretty sure these are just typos.
2020-10-18 12:05:25 -07:00
Collin Styles
9f3cbcd149 docs: wrap Arg in backticks instead of quotes
This looks better and is more consistent with the rest of the
documentation.
2020-10-18 12:05:22 -07:00
Collin Styles
b3caf81918 docs: fix a bunch of broken documentation links 2020-10-18 12:05:19 -07:00
CastilloDel
acd3293af2 Add an assertion for positional args defining long or short
Also update the docs to reflect that Arg.index shouldn't be
used with long or short
2020-10-18 19:51:13 +01:00
Jacob Mischka
b3e638ad44
Add option to hide autogenerated env section from help text 2020-10-17 16:48:35 -05:00
bors[bot]
d2dd54b555
Merge #2172
2172: Don't use default value when option is passed r=pksunkara a=davidhewitt



Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
2020-10-14 20:54:10 +00:00
David Hewitt
94f6889116 Don't use default value when option is passed 2020-10-14 20:00:40 +01:00
Wim Looman
b31df047b8 Attach validation error as Error::source 2020-10-13 22:13:04 +02:00
bors[bot]
5a1a209965
Merge #2161
2161: Fix parser skipping options without heading set r=pksunkara a=CertainLach



Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
2020-10-11 08:55:33 +00:00
Donough Liu
7f627fceee Change MissingArgumentOrSubcommand to DisplayHelpOnMissingArgumentOrSubcommand and don't use stderr 2020-10-11 15:42:47 +08:00
bors[bot]
4f90f3e4bb
Merge #2166
2166: Sort options base on option's short and long representation r=ldm0 a=ldm0



Co-authored-by: Donough Liu <ldm2993593805@163.com>
2020-10-10 18:54:49 +00:00
Donough Liu
15c77150a9 Sort options base on option's short and long representation 2020-10-11 02:08:10 +08:00
Marti Raudsepp
cda89a2af1 Fix typos and grammar
Some more fixes in addition to 594c535ba2
* Some I noticed manually.
* Some were found by Topy (https://github.com/intgr/topy), either new
  rules from Typo or new code in clap.
* `etc.` and `e.g.` rules were disabled during the last run.
2020-10-10 16:22:05 +03:00
Donough Liu
c9a407aa54 Fix: Don't mention unused subcommands (Partly cherry pick ef92e2b)
Add `\t` for consistency
2020-10-10 03:34:28 +08:00
bors[bot]
4ff4879400
Merge #2154
2154: Fix the error logic and error message for suggesting `--` before a flag r=pksunkara a=ldm0



Co-authored-by: Donough Liu <ldm2993593805@163.com>
2020-10-09 19:05:13 +00:00
Yaroslav Bolyukin
6050a17024
fix: #2022
Parser was skipping default values for options with headings

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
2020-10-09 23:45:11 +05:00
Donough Liu
9766aa11b1 Remove redundant(wrong) error processing
Argument prefixed by `-` will never inferred as a subcommand

Suggest using subcommand when supplied after `--`

Cargo fmt, adding test for wrongly using subcommand after `--`

Fix test

Fix clippy
2020-10-10 00:06:50 +08:00
Donough Liu
5815246fd9 Fix the error logic and error message for suggesting -- before a flag
Fix tests

Add test for issue #1284

Apply nitpicks
2020-10-10 00:04:22 +08:00
Pavan Kumar Sunkara
8131ead04b More changelog and consistency 2020-10-09 17:05:51 +02:00
Pavan Kumar Sunkara
b931e25c79 Update MSRV to 1.42 2020-10-09 17:04:46 +02:00
bors[bot]
91633741e9
Merge #2143
2143: api(App): Adds help_about method to App. r=pksunkara a=pretzelhammer



Co-authored-by: pretzelhammer <7769424+pretzelhammer@users.noreply.github.com>
2020-09-26 06:55:58 +00:00
pretzelhammer
523729d3fc api(App): Adds version_about method to App.
Version about text is now customizable and propagates to subcommands. Closes #1640.
2020-09-25 09:06:35 -04:00
bors[bot]
87c9699931
Merge #2135
2135: fix(help messages): escape values in help messages r=pksunkara a=ninewise



Co-authored-by: Felix Van der Jeugt <felix.vanderjeugt@posteo.net>
2020-09-25 09:16:05 +00:00
Felix Van der Jeugt
d5c7c7d8bd
Fix clippy errors 2020-09-25 10:38:35 +02:00
pretzelhammer
33caf49793 api(App): Adds help_about method to App.
Help about text is now customizable and propagates to subcommands. Closes #2080.
2020-09-24 17:53:02 -04:00
Felix Van der Jeugt
a083953d3a
Suggest corrections with double quotes 2020-09-24 17:58:35 +02:00
Pavan Kumar Sunkara
99b8830d0b Remove unneeded cfg_attr 2020-09-24 13:51:02 +02: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
Felix Van der Jeugt
0f42344685
fix(help messages): escape whitespace values in help messages 2020-09-16 15:51:33 +02:00
bors[bot]
03c11607b5
Merge #2132
2132: Add missing links in docs. r=pksunkara a=newAM



Co-authored-by: Alex M <alexmgit@protonmail.com>
2020-09-12 18:28:23 +00:00
Alex M
96db338697 Add missing links in docs. 2020-09-12 10:15:14 -07:00
Alex M
3758725dc2 Fix for issue #2130. 2020-09-12 09:52:52 -07:00
bors[bot]
3e9ee86713
Merge #2118
2118: Rename r=CreepySkeleton a=pksunkara



Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-08-29 11:22:13 +00:00
bors[bot]
61786c4971
Merge #2117
2117: Remove useless code r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
2020-08-29 10:58:07 +00:00
Pavan Kumar Sunkara
55abd639f7 Rename get_*_no_heading to get_*_with_no_heading 2020-08-29 11:49:04 +02:00