Martin von Zweigbergk
ea264fde16
fix(complete): Fix git diff git <TAB>
for Bash
...
Early in the Bash-completion script, we build up a string that
identifies the command or subcommand. When we see the top-level
command's name (e.g. `git`) we set the command so far to that
value. We do that regardless of where in the argument list it
appears. For example, if the argument list is `git diff git`, we set
the current command to `git` when run into it the second time. We
therefore suggest arguments to the top-level command afterwards, which
is not correct.
This patch fixes that by also considering the string that identifies
the command so far, so we only set the overall command to `git` if the
command so far is the empty string.
This is actually just a step on the way to getting completion to work
for aliases of subcommands.
Closes #4273
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
35b5f9b276
refactor(complete): Remove an always-true check
...
The `text` variable here is clearly never empty, so don't check if it
is.
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
9c59c69bb0
refactor(complete): Remove unnecessary early return
...
There seems to be little reason to return early with an empty list
when there are no subcommands, instead of going through the loop 0
times and then returning the empty list.
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
8d0ef124e0
test(complete): Include a visible command alias
...
Only zsh includes completion for visible aliases of subcommands. Let's
show that in tests.
2022-09-29 08:40:54 -07:00
Martin von Zweigbergk
5020d739d5
refactor(complete): Add an alias for the subcommand
...
I want to add support for completion of arguments for aliased
subcommands so it's nice to have an example to test on.
2022-09-29 08:39:49 -07:00
Martin von Zweigbergk
6bc8d2632c
refactor(complete): Add a subcommand to examples
...
It's useful when testing to have a subcommand in the examples.
2022-09-29 08:39:17 -07:00
Martin von Zweigbergk
8b33da3138
fix(complete): Make the two examples consistent
...
The derive-based example has a `///` comment on one argument, which
ends up as a description for the argument in the generated completion
scripts. Let's switch to `//` so the two scripts produce the same
output (except for the binary name), so they're easy to compare.
2022-09-29 08:37:03 -07:00
Martin von Zweigbergk
59270b1c81
fix(complete): Make example commands match binary
...
The example binaries were renamed in 89c2b3bb0d
, but the commands in
them were not, making the generated completion scripts not work
(because we use the command name as binary name in the examples).
2022-09-29 08:34:19 -07:00
Ed Page
9f30493e5f
chore: Release
2022-09-29 10:08:12 -05:00
Ed Page
5cab144f72
docs: Update changelog
2022-09-29 10:08:04 -05:00
Ed Page
7ea950a9ae
Merge pull request #4288 from epage/conflict
...
fix(error): Specialize the self-conflicts error
2022-09-29 10:07:26 -05:00
Ed Page
4e9f3cca2c
fix(error): Specialize the self-conflicts error
...
Inspired by rust-lang/cargo#11159
2022-09-29 09:54:20 -05:00
Ed Page
2c097814e4
test(error): Self-conflict
2022-09-29 09:43:33 -05:00
Ed Page
337a9e089b
chore: Release
2022-09-29 09:27:13 -05:00
Ed Page
d25d5b696d
docs: Update changelog
2022-09-29 09:27:06 -05:00
Ed Page
2583b8473d
Merge pull request #4287 from epage/usage
...
fix(error): Polish up errors a little
2022-09-29 09:23:27 -05:00
Ed Page
1a8ffc2a78
docs: Clarify support policy
2022-09-29 09:06:31 -05:00
Ed Page
5399f49572
fix(error): Quote literals consistently
2022-09-29 08:54:03 -05:00
Ed Page
2d86f96d64
fix(error): Stylize escape suggestions
2022-09-29 08:47:56 -05:00
Ed Page
549911a84a
fix(error): Format help suggestion as literal
2022-09-29 08:43:05 -05:00
Ed Page
4524127704
chore: Release
2022-09-28 17:02:08 -05:00
Ed Page
d279f7f4e6
docs: Update changelog
2022-09-28 17:01:56 -05:00
Ed Page
929c87c5b8
Merge pull request #4281 from epage/override
...
fix(parser): Allow one-off self-overrides
2022-09-28 17:00:55 -05:00
Ed Page
3683e2c791
fix(parser): Allow one-off self-overrides
...
bat needed this.
See also #4261
2022-09-28 16:45:35 -05:00
Ed Page
2d7874948f
fix(parser): SetFalse should also not allow self-override
2022-09-28 16:26:36 -05:00
Ed Page
bf42ff04d5
chore: Release
2022-09-28 15:34:33 -05:00
Ed Page
824f6589ad
docs: Update changelog
2022-09-28 15:34:25 -05:00
Ed Page
7b886d2c63
Merge pull request #4278 from intgr/zsh-completion-fix-multiple-args-handling
...
fix(complete): Fix zsh handling of multiple arguments
2022-09-28 15:33:42 -05:00
Marti Raudsepp
89cae3a2b3
fix(complete): Fix handling of multiple arguments
2022-09-28 23:02:31 +03:00
Ed Page
f6602c573c
chore: Release
2022-09-28 14:51:22 -05:00
Ed Page
1e171cfef6
docs: Update changelog
2022-09-28 14:47:24 -05:00
Ed Page
f1dffa1446
Merge pull request #4277 from epage/help
...
docs(complete): Ensure examples work
2022-09-28 14:45:35 -05:00
Ed Page
31e58cc45b
Merge pull request #4276 from epage/derive
...
fix(derive): Ensure clap/structopt attributes still work
2022-09-28 14:45:26 -05:00
Ed Page
cad5cde3e9
Merge pull request #4275 from wolthom/patch-1
...
Fix inline code snippet typos
2022-09-28 14:36:31 -05:00
Ed Page
8aafddff01
docs(complete): Ensure examples work
...
Fixes #4272
2022-09-28 14:34:56 -05:00
Ed Page
24be631f86
fix(derive): Ensure clap/structopt attributes still work
...
The problem with updating all code to use non-deprecated APIs, there
aren't tests for the old way anymore.
Fixes #4274
2022-09-28 14:29:39 -05:00
Ed Page
79ba02daa5
fix(derive): Quote the attribute in the error
2022-09-28 14:27:08 -05:00
Wolf Thomsen
0f45ac7235
Fix inline code snippet typos
...
There are a couple of typos where a backtick is missing / too much which results in slightly broken formatting. This PR should hopefully fix them.
2022-09-28 21:26:56 +02:00
Ed Page
5d9920480c
Merge branch 'master' into HEAD
2022-09-28 12:03:37 -05:00
Ed Page
3a74d82376
chore: Release
2022-09-28 12:00:48 -05:00
Ed Page
eed6aec503
Merge pull request #4271 from tahmid-23/mangen-hide-fix
...
fix(mangen): Respect more hide values
2022-09-27 15:47:39 -05:00
tahmid-23
e6cd076438
fix(mangen): Respect more hide values
2022-09-27 15:40:56 -04:00
Ed Page
9cd1939535
Merge pull request #4269 from epage/usage
...
fix(error): Polish `--flag=bad-value` error
2022-09-27 09:42:11 -05:00
Ed Page
cb1cd67009
fix(error): Include failed arg in usage in --flag=bad-value error
2022-09-27 09:25:24 -05:00
Ed Page
12d76d649a
fix(error): Include 'Usage:' title in --flag=bad-value error
2022-09-27 09:20:42 -05:00
Ed Page
3a8d2a579b
test(parser): Verify existing --flag=bad-value case
2022-09-27 09:19:27 -05:00
Ed Page
c7dd03e7ea
Merge pull request #4267 from jpgrayson/override-usage-help-4
...
docs: Update multiline usage override rules
2022-09-27 09:05:43 -05:00
Ed Page
f925ca84b6
docs: Clarify how to use examples
...
When we restuctured the examples, we lost the notes on how they should
be structured, so this adds it back in.
2022-09-26 21:06:02 -05:00
Peter Grayson
7dd216b1e6
docs: Update multiline usage override rules
...
The styling of usage has changed in #4188 such that the usage string is on
the same line as the "Usage:" title. Previously, the usage went on the line
below the title. As such, the rules have changed for how to make a
multiline usage format correctly.
These updated rules achieve the following output for the documented
example:
Usage: myapp -X [-a] [-b] <file>
myapp -Y [-c] <file1> <file2>
myapp -Z [-d|-e]
Relates-to: #4132
2022-09-26 21:57:09 -04:00
Ed Page
a0c8c7dbd5
docs: Clean up StyledStr entries
2022-09-26 13:51:56 -05:00