Commit graph

5434 commits

Author SHA1 Message Date
Ed Page
2e3540355a fix(derive): Don't change case of Arg id's (unstable)
This will make it easier to reference arguments with different
attributes.

Fixes #3282
2022-05-09 10:36:03 -05:00
Ed Page
f7e4dd23d6 refactor(derive): Divide rename_all assertions 2022-05-06 16:47:52 -05:00
Ed Page
ddc9d54f41 refactor(derive): Generalize test name 2022-05-06 16:45:03 -05:00
Ed Page
fe4888d668 refactor(derive): Group subcommand rename tests 2022-05-06 16:43:23 -05:00
Ed Page
fbb01d8b33
Merge pull request #3703 from epage/external
fix(parser): Disambiguate whether built-in subcommands are escaped (unstable)
2022-05-06 16:18:21 -05:00
Ed Page
eb155786bb fix(parser): Assert on unknown args when using external subcommands (unstable) 2022-05-06 15:49:33 -05:00
Ed Page
65538e21a8 fix(derive): Detect escaped ambiguous subcommands (unstable) 2022-05-06 15:46:34 -05:00
Ed Page
630dde7bf2
Merge pull request #3702 from epage/derive
feat(derive): Start `unstable-v4` feature flag
2022-05-06 15:08:13 -05:00
Liu Dingming
1b63fbd6df feat(derive): Start unstable-v4 feature flag
This is split out of #3661 as several changes I'm working on need it.
2022-05-06 14:56:55 -05:00
Ed Page
36f8e470dd
Merge pull request #3701 from epage/required
fix(assert): Detect conflicting arguments (unstable)
2022-05-06 14:45:41 -05:00
Ed Page
6ceb865c95 fix(assert): Detect conflicting arguments (unstable)
Fixes #3660
2022-05-06 14:29:35 -05:00
Ed Page
122b4b4ac1
Merge pull request #3700 from epage/value_name
fix(help): Define value name / number of values mismatch relationships
2022-05-06 14:15:47 -05:00
Ed Page
3d7ee2e5cd fix(assert): Verify required_unless_present_all exist 2022-05-06 14:11:37 -05:00
Ed Page
089f96eb87 fix(help): Disallow too many value names (unstable)
I can't think of a case for this or a way to render it.

Fixes #2695
2022-05-06 13:54:07 -05:00
Ed Page
70c29e3dd8 fix(help): Use '...' when not enough value names supplied 2022-05-06 13:33:17 -05:00
Ed Page
20ff4ce05a doc(parser): Document external subcommand escaping behavior 2022-05-06 12:38:23 -05:00
Ed Page
03f132129b fix(parser): Always put in arg "" for external subcommands (unstable)
This allows distinguishing external subcommands from built-in
subcommands which can especially be confusing when escaping subcommands.

Fixes #3263
2022-05-06 12:25:20 -05:00
Ed Page
55e791e80e chore: Release 2022-05-06 11:57:48 -05:00
Ed Page
ed0c01993c docs: Update changelog 2022-05-06 11:57:39 -05:00
Evgeniy Terekhin
229b44d9bb
fix(macros): Allow dashed values (#3699)
add support for dashed arg names and values in arg! macro
2022-05-06 10:58:00 -05:00
Ed Page
95698a4f31 chore: Release 2022-05-06 09:39:24 -05:00
Ed Page
3984e55363 docs(complete): Update changelog 2022-05-06 09:39:15 -05:00
Ed Page
1a1a842aa0
Merge pull request #3698 from epage/value
fix(complete): Complete visible, rather than hidden, values
2022-05-06 09:37:54 -05:00
Ed Page
b266e6d35d fix(complete): Complete visible, rather than hidden, values
In a refactor for #3503, one of the checks for `is_hide_set` got flipped
and we are completing hidden `PossibleValue`s rather than visible.

Fixes #3697
2022-05-06 09:14:32 -05:00
Ed Page
17b930c203 chore: Release 2022-05-05 21:04:09 -05:00
Ed Page
e74864994a docs: Update changelog 2022-05-05 20:55:44 -05:00
Ed Page
0e1e9525c8
Merge pull request #3696 from epage/usage
refactor(help): Remove more redundant required checks
2022-05-05 20:48:31 -05:00
Ed Page
05aecf8248 refactor(help): Remove more redundant required checks
Made redundant in #3689 but missed updating these.
2022-05-05 20:33:39 -05:00
Ed Page
dcda237ecc
Merge pull request #3689 from epage/usage
fix(error): Don't duplicate args in usage
2022-05-05 19:52:19 -05:00
Ed Page
e23c786f62 refactor(help): Remove redundant required check
With us moving the required de-duplication up a level, it made this
check redundant.  By removing this check, we're more likely to have an
item in the `incls` which forces a smart usage and reduces the chance of
an `[ARGS]` or `[OPTIONS]`, so a couple of tests changed.
2022-05-05 17:02:49 -05:00
Ed Page
f7c2deaa47 fix(help): Don't show hidden arguments for conflicts
This makes it consistent with other errors where we show arguments to
the user.
2022-05-05 12:16:56 -05:00
Ed Page
2375a8ec2a
Merge pull request #3693 from epage/template
fix(help): Use display name instead of bin name (unstable-v4)
2022-05-05 12:01:01 -05:00
Ed Page
e4c096ea99 fix(help): Use display name instead of bin name (unstable-v4)
This will mean we won't have an awkard `.exe` in the middle on Windows

This means users can have a display name for their application rather
than it being dependent on the binary name it was run as

This means users can manually set it to use spaces instead of dashes for
separating things out.

Fixes #992
Fixes #1474
Fixes #1431
2022-05-04 20:46:49 -05:00
Ed Page
16791ab0a7 test(help): Update for display name change 2022-05-04 20:46:49 -05:00
Ed Page
41a8a5b351
Merge pull request #3692 from epage/break
fix(help): Don't wrap URLs
2022-05-04 16:47:33 -05:00
Ed Page
c7ff695581 fix(help): Don't wrap URLs
Confusingly, there are two similar but slightly different settings in
`textwrap`.  We need both set.

Fixes #3222
2022-05-04 16:00:08 -05:00
Ed Page
fff1b116eb
Merge pull request #3691 from epage/dash
fix(v4): Disallow leading dashes in long's
2022-05-04 15:53:00 -05:00
Ed Page
d3e36b1c90 fix(v4): Disallow leading dashes in long's
This is a step towards #3309.  We want to make longs and long aliases
more consistent in how they handle leading dashes.  There is more
flexibility offered in not stripping and it matches the v3 short
behavior of only taking the non-dash form.  This starts the process by
disallowing it completely so people will catch problems with it and
remove their existing leading dashes.  In a subsequent breaking release
we can remove the debug assert and allow triple-leading dashes.
2022-05-04 15:38:08 -05:00
Ed Page
8bea44d745 docs(help): Document name help_template variable 2022-05-04 14:43:58 -05:00
Ed Page
4da6374727
Merge pull request #3690 from epage/exclusive
fix(parser): Exclusive overrides required
2022-05-04 13:26:32 -05:00
Ed Page
61b8bbd218 fix(parser): Exclusive overrides required
`Arg::exclusive` is just another way of defining conflicts, so a
present-exclusive arg should override required like other conflicts.

Instead of going through the message of enumerating all other arguments
as exclusive, I shortcutted it and special case exclusive in the
required check like we do with conflicts.  The big downside is the
implicit coupling between the code paths rather than having a consistent
abstraction for covering conflicts.

This isn't a breaking change because if someone defined an exclusive arg
as a sibling to a required arg, the exclusive arg could never be used,
it always errored, and so no valid application can be written with it.

Fixes #3595
2022-05-04 12:25:44 -05:00
Ed Page
88472224dc perf(parser): Short-circuit exclusive validation 2022-05-04 12:13:51 -05:00
Ed Page
dedbabd402 fix(error): Don't duplicate args in usage
Gave up trying to decipher the existing logic for safe ways to
de-duplicate manually and switched to an `IndexSet` to enforce only one
of each argument exists.

Fixes #3556
2022-05-04 11:05:37 -05:00
Ed Page
7deb724e08
Merge pull request #3687 from clap-rs/dependabot/github_actions/actions/checkout-3
chore(deps): bump actions/checkout from 2 to 3
2022-05-04 08:24:09 -05:00
dependabot[bot]
269cde50d5
chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-04 13:09:07 +00:00
Ed Page
7c90d68101
Merge pull request #3686 from clap-rs/dependabot/github_actions/actions/setup-python-3
chore(deps): bump actions/setup-python from 2 to 3
2022-05-04 08:08:39 -05:00
dependabot[bot]
a377f60011
chore(deps): bump actions/setup-python from 2 to 3
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 3.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-04 12:54:13 +00:00
Ed Page
cd102a29ea
Merge pull request #3685 from turrisxyz/feat/dependabot-github-actions
chore: Included githubactions in the dependabot config
2022-05-04 07:53:41 -05:00
naveensrinivasan
fcd78724f8
chore: Included githubactions in the dependabot config
This should help with keeping the GitHub actions updated on new releases. This will also help with keeping it secure.

Dependabot helps in keeping the supply chain secure https://docs.github.com/en/code-security/dependabot

GitHub actions up to date https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot

https://github.com/ossf/scorecard/blob/main/docs/checks.md#dependency-update-tool
Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
2022-05-03 21:36:38 -05:00
Ed Page
efd2253660
Merge pull request #3683 from epage/multicall
docs(multicall): Expand documentation in prep for stablization
2022-05-03 16:44:37 -05:00