mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
Merge pull request #5317 from epage/author
docs: Adjust how we approach `author`
This commit is contained in:
commit
ef45f2d4e7
26 changed files with 23 additions and 25 deletions
|
@ -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>,
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -3,7 +3,6 @@ use clap::{arg, Command};
|
|||
fn main() {
|
||||
let matches = Command::new("MyApp")
|
||||
.version("1.0")
|
||||
.author("Kevin K. <kbknapp@gmail.com>")
|
||||
.about("Does awesome things")
|
||||
.arg(arg!(--two <VALUE>).required(true))
|
||||
.arg(arg!(--one <VALUE>).required(true))
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -2,7 +2,6 @@ use clap::Parser;
|
|||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "MyApp")]
|
||||
#[command(author = "Kevin K. <kbknapp@gmail.com>")]
|
||||
#[command(version = "1.0")]
|
||||
#[command(about = "Does awesome things", long_about = None)]
|
||||
struct Cli {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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>,
|
||||
}
|
||||
|
|
|
@ -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>,
|
||||
}
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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..))]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue