Skip to content

Commit 106d8f5

Browse files
authored
Merge pull request #4309 from epage/docs
docs: Fix a few items
2 parents 6328c14 + 16e5599 commit 106d8f5

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ Easier to catch changes:
272272
- Removed `PartialEq` and `Eq` from `Command` so we could change external subcommands to use a `ValueParser` (#3990)
273273
- Various `Arg`, `Command`, and `ArgGroup` calls were switched from accepting `&[]` to `[]` via `IntoIterator` to be more flexible (#4072)
274274
- `Arg::short_aliases` and other builder functions that took `&[]` need the `&` dropped (#4081)
275+
- `ErrorKind` and `Result` moved into the `error` module
275276
- `ErrorKind::EmptyValue` replaced with `ErrorKind::InvalidValue` to remove an unnecessary special case (#3676, #3968)
276277
- `ErrorKind::UnrecognizedSubcommand` replaced with `ErrorKind::InvalidSubcommand` to remove an unnecessary special case (#3676)
277278
- Changed the default type of `allow_external_subcommands` from `String` to `OsString` as that is less likely to cause bugs in user applications (#3990)

src/builder/arg.rs

-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ impl Arg {
466466
/// [`Arg::short`]: Arg::short()
467467
/// [`Arg::long`]: Arg::long()
468468
/// [`Arg::num_args(true)`]: Arg::num_args()
469-
/// [`panic!`]: https://doc.rust-lang.org/std/macro.panic!.html
470469
/// [`Command`]: crate::Command
471470
#[inline]
472471
#[must_use]

src/builder/command.rs

+21-12
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,6 @@ impl Command {
946946

947947
/// Try not to fail on parse errors, like missing option values.
948948
///
949-
/// **Note:** Make sure you apply it as `global_setting` if you want this setting
950-
/// to be propagated to subcommands and sub-subcommands!
951-
///
952949
/// **NOTE:** This choice is propagated to all child subcommands.
953950
///
954951
/// # Examples
@@ -1132,9 +1129,6 @@ impl Command {
11321129
///
11331130
/// Defaults to `false`; subcommands have independent version strings from their parents.
11341131
///
1135-
/// **Note:** Make sure you apply it as `global_setting` if you want this setting
1136-
/// to be propagated to subcommands and sub-subcommands!
1137-
///
11381132
/// **NOTE:** This choice is propagated to all child subcommands.
11391133
///
11401134
/// # Examples
@@ -1457,6 +1451,9 @@ impl Command {
14571451
/// automatically set your application's author(s) to the same thing as your
14581452
/// crate at compile time.
14591453
///
1454+
/// **NOTE:** A custom [`help_template`][Command::help_template] is needed for author to show
1455+
/// up.
1456+
///
14601457
/// # Examples
14611458
///
14621459
/// ```no_run
@@ -1465,7 +1462,6 @@ impl Command {
14651462
/// .author("Me, me@mymain.com")
14661463
/// # ;
14671464
/// ```
1468-
/// [`crate_authors!`]: ./macro.crate_authors!.html
14691465
#[must_use]
14701466
pub fn author(mut self, author: impl IntoResettable<Str>) -> Self {
14711467
self.author = author.into_resettable().into_option();
@@ -1620,7 +1616,6 @@ impl Command {
16201616
/// .version("v0.1.24")
16211617
/// # ;
16221618
/// ```
1623-
/// [`crate_version!`]: ./macro.crate_version!.html
16241619
#[must_use]
16251620
pub fn version(mut self, ver: impl IntoResettable<Str>) -> Self {
16261621
self.version = ver.into_resettable().into_option();
@@ -1648,7 +1643,6 @@ impl Command {
16481643
/// binary: myprog")
16491644
/// # ;
16501645
/// ```
1651-
/// [`crate_version!`]: ./macro.crate_version!.html
16521646
#[must_use]
16531647
pub fn long_version(mut self, ver: impl IntoResettable<Str>) -> Self {
16541648
self.long_version = ver.into_resettable().into_option();
@@ -1767,13 +1761,31 @@ impl Command {
17671761
///
17681762
/// # Examples
17691763
///
1764+
/// For a very brief help:
1765+
///
17701766
/// ```no_run
17711767
/// # use clap::Command;
17721768
/// Command::new("myprog")
17731769
/// .version("1.0")
17741770
/// .help_template("{bin} ({version}) - {usage}")
17751771
/// # ;
17761772
/// ```
1773+
///
1774+
/// For showing more application context:
1775+
///
1776+
/// ```no_run
1777+
/// # use clap::Command;
1778+
/// Command::new("myprog")
1779+
/// .version("1.0")
1780+
/// .help_template("\
1781+
/// {before-help}{name} {version}
1782+
/// {author-with-newline}{about-with-newline}
1783+
/// {usage-heading} {usage}
1784+
///
1785+
/// {all-args}{after-help}
1786+
/// ")
1787+
/// # ;
1788+
/// ```
17771789
/// [`Command::about`]: Command::about()
17781790
/// [`Command::long_about`]: Command::long_about()
17791791
/// [`Command::after_help`]: Command::after_help()
@@ -2844,9 +2856,6 @@ impl Command {
28442856
/// values subcommand
28452857
/// ```
28462858
///
2847-
/// **Note:** Make sure you apply it as `global_setting` if you want this setting
2848-
/// to be propagated to subcommands and sub-subcommands!
2849-
///
28502859
/// # Examples
28512860
///
28522861
/// ```rust

src/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ macro_rules! arg_impl {
533533
/// assert_eq!(*m.get_one::<u8>("debug").unwrap(), 0);
534534
/// assert_eq!(m.get_one::<String>("input"), None);
535535
/// ```
536-
/// [`Arg`]: ./struct.Arg.html
536+
/// [`Arg`]: crate::Arg
537537
#[macro_export]
538538
macro_rules! arg {
539539
( $name:ident: $($tail:tt)+ ) => {

0 commit comments

Comments
 (0)