logo
#[non_exhaustive]
pub enum AppSettings {
Show 34 variants IgnoreErrors, WaitOnError, AllowHyphenValues, AllowNegativeNumbers, AllArgsOverrideSelf, AllowMissingPositional, TrailingVarArg, DontDelimitTrailingValues, InferLongArgs, InferSubcommands, SubcommandRequired, SubcommandRequiredElseHelp, AllowExternalSubcommands, Multicall, AllowInvalidUtf8ForExternalSubcommands, UseLongFormatForHelpSubcommand, SubcommandsNegateReqs, ArgsNegateSubcommands, SubcommandPrecedenceOverArg, ArgRequiredElseHelp, DeriveDisplayOrder, DontCollapseArgsInUsage, NextLineHelp, DisableColoredHelp, DisableHelpFlag, DisableHelpSubcommand, DisableVersionFlag, PropagateVersion, Hidden, HidePossibleValues, HelpExpected, NoBinaryName, NoAutoHelp, NoAutoVersion, // some variants omitted
}
Expand description

Application level settings, which affect how Command operates

NOTE: When these settings are used, they apply only to current command, and are not propagated down or up through child or parent subcommands

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

IgnoreErrors

Deprecated, replaced with Command::ignore_errors

WaitOnError

Deprecated, replace

let cmd = clap::Command::new("cmd")
    .global_setting(clap::AppSettings::WaitOnError)
    .arg(clap::arg!(--flag));
let m = cmd.get_matches();

with

let cmd = clap::Command::new("cmd")
    .arg(clap::arg!(--flag));
let m = match cmd.try_get_matches() {
    Ok(m) => m,
    Err(err) => {
        if err.use_stderr() {
            let _ = err.print();

            eprintln!("\nPress [ENTER] / [RETURN] to continue...");
            use std::io::BufRead;
            let mut s = String::new();
            let i = std::io::stdin();
            i.lock().read_line(&mut s).unwrap();

            std::process::exit(2);
        } else {
            let _ = err.print();
            std::process::exit(0);
        }
    }
};

AllowHyphenValues

AllowNegativeNumbers

AllArgsOverrideSelf

Deprecated, replaced with Command::args_override_self

AllowMissingPositional

TrailingVarArg

DontDelimitTrailingValues

InferLongArgs

Deprecated, replaced with Command::infer_long_args

InferSubcommands

Deprecated, replaced with Command::infer_subcommands

SubcommandRequired

SubcommandRequiredElseHelp

Deprecated, replaced with Command::subcommand_required combined with Command::arg_required_else_help.

AllowExternalSubcommands

Multicall

Deprecated, replaced with Command::multicall and Command::is_multicall_set

AllowInvalidUtf8ForExternalSubcommands

UseLongFormatForHelpSubcommand

Deprecated, this is now the default

SubcommandsNegateReqs

ArgsNegateSubcommands

SubcommandPrecedenceOverArg

ArgRequiredElseHelp

DeriveDisplayOrder

Displays the arguments and subcommands in the help message in the order that they were declared in, and not alphabetically which is the default.

To override the declaration order, see Arg::display_order and Command::display_order.

Examples

Command::new("myprog")
    .global_setting(AppSettings::DeriveDisplayOrder)
    .get_matches();

DontCollapseArgsInUsage

NextLineHelp

DisableColoredHelp

DisableHelpFlag

DisableHelpSubcommand

DisableVersionFlag

PropagateVersion

Hidden

Deprecated, replaced with Command::hide and Command::is_hide_set

HidePossibleValues

HelpExpected

Deprecated, replaced with Command::help_expected

NoBinaryName

Deprecated, replaced with Command::no_binary_name

NoAutoHelp

Deprecated, replaced with Arg::action

NoAutoVersion

Deprecated, replaced with Arg::action

Trait Implementations

The resulting type after applying the | operator.

Performs the | operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deprecated in Issue #3087, maybe clap::Parser would fit your use case?

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.