Commit graph

4259 commits

Author SHA1 Message Date
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
Pavan Kumar Sunkara
975ceed904 Update CI badge on README 2021-03-10 08:04:16 +05:30
Pavan Kumar Sunkara
ad1adb7807
Merge pull request #2399 from ldm0/allow_empty_values
Implement NoEquals error
2021-03-10 04:43:47 +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
Pavan Kumar Sunkara
d53f192587
Merge pull request #2362 from ldm0/demangle
Demangle interlinking flags
2021-03-09 23:19:06 +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
Pavan Kumar Sunkara
63612496ca
Merge pull request #2394 from loloicci/feat-print-parse-error
feat: implement print to parse::Error
2021-03-09 16:41:47 +05:30
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
Pavan Kumar Sunkara
b94b9872a5
Merge pull request #2382 from christophprokop/fix-code-example
Fix code example to match help text
2021-03-05 15:02:57 +05:30
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
Pavan Kumar Sunkara
e242cc1c7b
Merge pull request #2374 from dylni/upgrade-os-str-bytes
Upgrade os_str_bytes
2021-03-02 02:10:42 +00:00
dylni
8a6881169b Upgrade os_str_bytes 2021-03-01 17:58:53 -05:00
Pavan Kumar Sunkara
ace23dd197
Merge pull request #2371 from omar25h/required-if-eq-all
feat: Implement Arg::required_if_eq_all
2021-02-28 13:50:50 +00:00
Omar El Halabi
701a4610b3 feat: Implement Arg::required_if_eq_all 2021-02-28 14:52:34 +02:00
Pavan Kumar Sunkara
c9e875e036
Merge pull request #2369 from logansquirel/master
fix: Compatibility with help2man
2021-02-27 17:19:31 +00:00
Logan SQUIREL
52e74fa305
Fix App::version/long_version test 2021-02-27 16:31:32 +01: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
Pavan Kumar Sunkara
96f1fce087 Converted the issue templates to forms 2021-02-26 00:45:53 +00:00
Pavan Kumar Sunkara
d3623114c8 Create bug_report.yml 2021-02-26 00:34:49 +00:00
Pavan Kumar Sunkara
ecdc8ed80e
Merge pull request #2363 from HeroicKatora/master
Optimize common case of space padding
2021-02-25 13:52:57 +00:00
Andreas Molzer
c6ea3720ab Optimize common case of space padding 2021-02-25 13:26:39 +01:00
Pavan Kumar Sunkara
4067707302
Merge pull request #2361 from kevgo/patch-1
Fix typo
2021-02-24 18:44:22 +00:00
Kevin Goslar
205479a2b1
Fix typo 2021-02-24 08:00:59 -06:00
Pavan Kumar Sunkara
d92592a63b
Merge pull request #2358 from logansquirel/master
Fix issue #2181
2021-02-22 16:08:06 +00:00
Pavan Kumar Sunkara
69d32bca15
Merge pull request #2359 from blyxxyz/fish-avoid-useless-subcommand-detection
fix: Do not look for subcommands in fish completion if none exist
2021-02-22 16:02:38 +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
cd8660fbd0
Fix issue #2181
- help / version flag report correct application name when generated
with clap_derive and an Enum.
- add clap_derive unit tests for application name:
  file: clap_derive/tests/app_name.rs
  tests: app_name_in_[short|long]_[help|version]_from_[struct|enum]()
2021-02-22 15:01:02 +01:00
Pavan Kumar Sunkara
90a74044ee
Merge pull request #2349 from logansquirel/master
imp: Visible aliases for arguments in completions
2021-02-22 09:09:25 +00: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
Pavan Kumar Sunkara
7a5b7b0ada
Merge pull request #2285 from mgeisler/str-width-count-chars
feat: count chars instead of bytes in str_width
2021-02-20 21:06:24 +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
Pavan Kumar Sunkara
0f92d5f2c3
Merge pull request #2352 from ldm0/all
Add --all-features for CI, fix build with debug feature.
2021-02-18 20:39:43 +00:00
ldm0
2d26f02605 Add --all-features for CI, fix build with debug feature. 2021-02-17 04:37:08 +00:00
ldm0
3873b647d1 Add tests for 2229 2021-02-16 03:58:58 +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