Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Adjust how we approach author #5317

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/cargo-example-derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ enum CargoCli {
}

#[derive(clap::Args)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct ExampleDeriveArgs {
#[arg(long)]
manifest_path: Option<std::path::PathBuf>,
Expand Down
2 changes: 1 addition & 1 deletion examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Parser;

/// Simple program to greet a person
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Args {
/// Name of the person to greet
#[arg(short, long)]
Expand Down
2 changes: 1 addition & 1 deletion examples/escaped-positional-derive.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)] // requires `derive` feature
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
#[arg(short = 'f')]
eff: bool,
Expand Down
1 change: 0 additions & 1 deletion examples/pacman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ fn main() {
.version("5.2.1")
.subcommand_required(true)
.arg_required_else_help(true)
.author("Pacman Development Team")
// Query subcommand
//
// Only a few of its arguments are implemented below.
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial_builder/02_apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use clap::{arg, Command};
fn main() {
let matches = Command::new("MyApp")
.version("1.0")
.author("Kevin K. <[email protected]>")
.about("Does awesome things")
.arg(arg!(--two <VALUE>).required(true))
.arg(arg!(--one <VALUE>).required(true))
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/01_quick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::PathBuf;
use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
/// Optional name to operate on
name: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/02_app_settings.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
#[command(next_line_help = true)]
struct Cli {
#[arg(long)]
Expand Down
1 change: 0 additions & 1 deletion examples/tutorial_derive/02_apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use clap::Parser;

#[derive(Parser)]
#[command(name = "MyApp")]
#[command(author = "Kevin K. <[email protected]>")]
#[command(version = "1.0")]
#[command(about = "Does awesome things", long_about = None)]
struct Cli {
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/02_crate.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)] // Read from `Cargo.toml`
#[command(version, about, long_about = None)] // Read from `Cargo.toml`
struct Cli {
#[arg(long)]
two: String,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_01_flag_bool.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
#[arg(short, long)]
verbose: bool,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_01_flag_count.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
#[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_02_option.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
#[arg(short, long)]
name: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_02_option_mult.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
#[arg(short, long)]
name: Vec<String>,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_03_positional.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
name: Option<String>,
}
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_03_positional_mult.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
name: Vec<String>,
}
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_04_subcommands.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
struct Cli {
#[command(subcommand)]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_04_subcommands_alt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::{Args, Parser, Subcommand};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
struct Cli {
#[command(subcommand)]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/03_05_default_values.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
#[arg(default_value_t = 2020)]
port: u16,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/04_01_enum.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::{Parser, ValueEnum};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
/// What mode to run the program in
#[arg(value_enum)]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/04_02_parse.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
/// Network port to use
#[arg(value_parser = clap::value_parser!(u16).range(1..))]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/04_02_validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::ops::RangeInclusive;
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
/// Network port to use
#[arg(value_parser = port_in_range)]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/04_03_relations.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::{Args, Parser};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
#[command(flatten)]
vers: Vers,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/04_04_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::error::ErrorKind;
use clap::{CommandFactory, Parser};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
/// set version manually
#[arg(long, value_name = "VER")]
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_derive/05_01_assert.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
#[command(version, about, long_about = None)]
struct Cli {
/// Network port to use
port: u16,
Expand Down
2 changes: 1 addition & 1 deletion src/_derive/_tutorial/chapter_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//!
#![doc = include_str!("../../../examples/tutorial_derive/02_apps.md")]
//!
//! You can use [`#[command(author, version, about)]` attribute defaults][super#command-attributes] on the struct to fill these fields in from your `Cargo.toml` file.
//! You can use [`#[command(version, about)]` attribute defaults][super#command-attributes] on the struct to fill these fields in from your `Cargo.toml` file.
//!
//! ```rust
#![doc = include_str!("../../../examples/tutorial_derive/02_crate.rs")]
Expand Down
1 change: 1 addition & 0 deletions src/_derive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
//! - `author [= <expr>]`: [`Command::author`][crate::Command::author]
//! - When not present: no author set
//! - Without `<expr>`: defaults to [crate `authors`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-authors-field)
//! - **NOTE:** A custom [`help_template`][crate::Command::help_template] is needed for author to show up.
//! - `about [= <expr>]`: [`Command::about`][crate::Command::about]
//! - When not present: [Doc comment summary](#doc-comments)
//! - Without `<expr>`: [crate `description`](https://doc.rust-lang.org/cargo/reference/manifest.html#the-description-field) ([`Parser`][crate::Parser] container)
Expand Down
Loading