clap-rs / clap

A full featured, fast Command Line Argument Parser for Rust
docs.rs/clap
Apache License 2.0
14.14k stars 1.03k forks source link

docs(builder): Avoid creating link to now-undocumented method #5371

Closed BenWiederhake closed 7 months ago

BenWiederhake commented 7 months ago

(This is an obvious bug or documentation fix, so that's why I skip the issue creation process.)

Currently, the method Command::dont_delimit_trailing_values contains a link to Command::trailing_var_arg, but that link is dead, as the method is not documented (anymore).

Therefore, the documentation for this method should link to Arg::trailing_var_arg instead, which is exactly what this PR does.

Note that there are a few more questionable uses of Command::trailing_var_arg, which I didn't dare to touch:

$ git grep -Firn 'nd::trailing_var'
clap_builder/src/builder/value_hint.rs:52:    /// [`.num_args(1..)`] and Command must use [`Command::trailing_var_arg(true)`]. The result is that the
clap_builder/src/builder/value_hint.rs:56:    /// [`Command::trailing_var_arg(true)`]: crate::Command::trailing_var_arg
clap_complete/examples/completion-derive.rs:56:    // Command::trailing_var_ar is required to use ValueHint::CommandWithArguments

The first two may or may not be outdated; the last one might be outdated, and is a typo in any case. But I'm not sure enough to fix either of them.

Bonus points if someone writes a linter that automatically checks whether documentation-internal links point to #[doc(hidden)] items. :-)

BenWiederhake commented 7 months ago

Changes since last push:

epage commented 7 months ago

Thanks!