Commit graph

227 commits

Author SHA1 Message Date
Ed Page
97e36451cf docs: Update stale references to AppSettings 2022-02-11 15:58:12 -06:00
Ed Page
8f201d8dd6 docs: Stop demonstrating SubcommandRequiredElseHelp 2022-02-11 15:01:02 -06:00
Ed Page
06d43a02da fix(help): Subcommand help looks like --help
Like was said in #2435, this is what people would expect.

While we should note this in a compatibility section in the changelog, I
do not consider this a breaking change since we should be free to adjust
the help output as needed.  We are cautious when people might build up
their own content around it (like #3312) but apps should already handle
this with `--help` so this shouldn't be a major change.

We aren't offering a way for people to disable this, assuming people
won't need to.  Longer term, we are looking at support "Actions" (#3405)
and expect those to help customize the flags.  We'll need something
similar for the `help` subcommand.

Fixes #3440
2022-02-11 12:47:34 -06:00
Ed Page
272f840178 feat: Replace core set of AppSettings with functions
This is a part of #2717

Some settings didn't get getters because
- They are transient parse settings (e.g. ignore errors)
- They get propagated to args and should be checked there

`is_allow_hyphen_values_set` is a curious case.  In some cases, we only
check the app and not an arg.  This seems suspicious.
2022-02-11 12:35:09 -06:00
Ed Page
f00f97c8c4 docs(examples): Add missing feature flag reqs 2022-02-11 07:07:03 -06:00
Ed Page
47d76742eb feat: Add Arg getters for all settings
This is prep for #2717
2022-02-10 10:18:41 -06:00
josh rotenberg
ee3eab1614 docs(tutorial): Demonstrate custom parsing
Adds a more in depth validator to validate that the port is in range in the derive and builder tutorial (section 4.2).

This supersedes #3416
2022-02-09 09:16:57 -06:00
Ed Page
06b6714a48 docs(contrib): Call out parallel tutorials 2022-02-08 07:08:14 -06:00
Ed Page
5290f82133 feat: Override DeriveDisplayOrder behavior with App::next_display_order
For the derive API, you can only call `next_display_order` when dealing
with a flatten.  Until we offer app attributes on arguments, the user can workaround with
this no-op flattens.

This is a part of #1807
2022-02-07 19:19:11 -06:00
Ed Page
c00f71ec4a feat: Add App::next_help_heading
This clarifies the intent and prepares for other functions doing the
same, like `next_display_order`.  This will then open us to name
`subcommand_help_heading` and `display_order` similar.

The deprecation is waiting on 3.1.

This is part of #1807 and #1553.
2022-02-07 19:19:01 -06:00
Ed Page
0dfdeb07bc test: Update 2022-02-07 13:28:48 -06:00
Ed Page
d318752cac docs(derive): Expand on parse attribute 2022-02-02 10:37:47 -06:00
mikehoyle
50b3d2966e
Correct README syntax for bool flag (#3346)
The proper syntax for the attribute is "parse" not "parser".
2022-01-26 08:41:09 -06:00
Ed Page
f32d640d49 docs(tutorial): Talk about required/optional subcommands
Inspired by https://github.com/clap-rs/clap/discussions/3342

Looks like we already cover this in the derive reference.
2022-01-25 09:39:14 -06:00
omjadas
86c83d296f
feat: Add default_value_os_t (#3333)
The order of suffixes allows us to preserve the original builder function name.

This is a part of #2813
2022-01-24 15:32:21 -06:00
Ed Page
ddad3a7923 docs(derive): Clarify from_flag's interactions 2022-01-20 09:55:13 -06:00
Ed Page
63a36673e1 docs(derive): Link ref to tutorial / examples 2022-01-11 14:27:39 -06:00
Ed Page
6b3248fff1 docs(derive): Link tutorial to reference 2022-01-11 14:22:54 -06:00
Ed Page
4b51b8e253 docs(examples): Steer people to know about about vs long_about
`#[clap(about)]` only overrides `about`.  If the doc comment also sets
`long_about`, it won't be overridden.  This change is to help raise
visibility of reseting `long_about` in these cases.
2022-01-10 18:47:24 -06:00
Ed Page
64d16bbc03 docs(derive): Clarify which Cargo.toml field is read 2022-01-10 18:32:32 -06:00
Ed Page
c5ace9aaa6 docs(derive): Clarify what can be used with flatten 2022-01-10 08:03:59 -06:00
Ed Page
fe56bb112d doc(derive): Clarify need to do long_about = None 2022-01-10 07:25:54 -06:00
Hugo Osvaldo Barrera
7110401595 docs: Fix messed up highlighting
This just affects how it's rendered; rather than attempting to highlight
these blocks as a shell script, they'll get highlighted as console
output.

See the rendered versions for a better comparison.
2022-01-05 11:53:06 -06:00
Daniel Eades
2986a9eee0 style: remove unnecessary lazy evaluations 2022-01-04 09:20:17 -06:00
Ed Page
b0cb2057ea docs(derive): Include name magic attribute
Inspired by #3242l
2022-01-03 06:33:53 -06:00
Ed Page
3bb33387af docs(derive): Remove redundant setting 2022-01-01 19:51:17 -06:00
Ed Page
f596bb3ce8 docs(tutorial): Fix another internal link 2021-12-29 18:07:11 -06:00
Emiel Van Severen
657f32a59b
Fix broken internal link 2021-12-30 01:00:29 +01:00
迷渡
9faec11b84
docs: Fix link to 'Configuring the Parser'
Signed-off-by: 迷渡 <justjavac@gmail.com>
2021-12-24 12:41:09 +08:00
Ed Page
3db09f4dd4 fix: Don't panic on lack of conflicts
Fixes #3197
2021-12-23 13:38:23 -06:00
Ed Page
a37f2908c8 docs(derive): Looks like optional isnt supported
According to #2587
2021-12-23 10:29:34 -06:00
Ed Page
653617d0fd docs(derive): Add flatten/subcommand for variants 2021-12-23 10:27:07 -06:00
Ed Page
5643dddf3e docs(tutorial): Encourage App::debug_assert 2021-12-23 08:41:52 -06:00
Ed Page
efca08341a docs(tutorial): Fix derive anchor links 2021-12-23 08:23:32 -06:00
迷渡
c60d5dd1f0
docs: Fix anchor links 2021-12-23 10:58:14 +08:00
Ed Page
8924dd7a1e feat(derive): Don't require Display for default ArgEnum
While I'm unsure how much type specialization we should do, we
intentionally have the `arg_enum` attribute for doing special behavior
based on it, so let's take advantage of it.

Fixes #3185
2021-12-16 09:11:32 -06:00
Ed Page
aa270f6aca docs(examples): Add cargo subcommand example 2021-12-15 12:07:29 -06:00
Ed Page
03cb509d6c refactor(examples): Change naming style
This is to make room for a reasonable looking cargo plugin example.

I got lazy and didn't update the tutorials.
2021-12-15 11:12:18 -06:00
Ed Page
9e64387ef0 revert(help): Partial revert of 3c049b4
The extra whitespace was targeted at machine processing for a subset of
users for a subset of runs of CLIs.  On the other hand, there is a lot
of concern over the extra verbose output.

A user can set the help template for man, if desired.  They can even do
something (env? feature flag?) to make it only run when doing man
generation.  We also have #3174 in the works.

So let's focus on the end-user reading `--help`.  People wanting to use
`help2man` have workarounds to do what they need.

Fixes #3096
2021-12-15 10:36:59 -06:00
Ed Page
b0f1750e81
Merge pull request #3041 from fishface60/master
Rewrite Multicall handling to just strip path off argv0
2021-12-13 09:21:59 -06:00
p4tr1ck
f3afcee855 examples: Fix typo 2021-12-13 22:34:08 +08:00
DerZade
7c60180e24 docs: Fix copy paste error in example 2021-12-13 11:41:12 +01:00
Richard Maw
38b9645bed fix: Windows Multicall support
The executable suffix is unconditionally stripped off the file path
so that the file name matches subcommands names
without having to add the EXE suffix on different platforms.
2021-12-12 22:08:25 +00:00
Richard Maw
17c64ef42b fix: Example typo 2021-12-12 22:08:25 +00:00
Richard Maw
e3d355fa85 feat: Make Multicall just strip dir from argv0 2021-12-12 22:08:25 +00:00
Hiroaki ITO
c2dc425784
docs: Fix the pacman-like interface example link 2021-12-11 22:22:09 +09:00
Ed Page
cf93d7c75a docs: Fix example output
How did #3112 get merged?
2021-12-09 10:26:01 -06:00
Ed Page
7731ca2d21 docs(derive): Show how to override special types
Fixes #3107
2021-12-09 09:32:33 -06:00
Ed Page
367879ac2a docs: Fix reference to feature flags 2021-12-08 19:25:48 -06:00
Ed Page
32b5520ff1 docs: Call out features used in root examples
mitsuhiko immediately jumped into the examples and got tripped up by the
lack of documentation on feature flags needed.

I limited this to just the root ones because the rest are in a more
proper tutorial that steps through it all.
2021-12-08 16:46:49 -06:00