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

Derive: replace #[clap(setting = IgnoreErrors)] with #[clap(ignore_errors = true)]

Builder: replace cmd.setting(IgnoreErrors) with cmd.ignore_errors = true

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

Deprecated, replaced with Command::allow_hyphen_values and Arg::is_allow_hyphen_values_set

Derive: replace #[clap(setting = AllowHyphenValues)] with #[clap(allow_hyphen_values = true)]

Builder: replace cmd.setting(AllowHyphenValues) with cmd.allow_hyphen_values(true)

AllowNegativeNumbers

Deprecated, replaced with Command::allow_negative_numbers and Command::is_allow_negative_numbers_set

Derive: replace #[clap(setting = AllowNegativeNumbers)] with #[clap(allow_negative_numbers = true)]

Builder: replace cmd.setting(AllowNegativeNumbers) with cmd.allow_negative_numbers(true)

AllArgsOverrideSelf

Deprecated, replaced with ArgAction::Set

The new actions (ArgAction::Set, ArgAction::SetTrue) do this by default.

See ArgAction::StoreValue and ArgAction::IncOccurrence for how to migrate

AllowMissingPositional

Deprecated, replaced with Command::allow_missing_positional and Command::is_allow_missing_positional_set

Derive: replace #[clap(setting = AllowMissingPositional)] with #[clap(allow_missing_positional = true)]

Builder: replace cmd.setting(AllowMissingPositional) with cmd.allow_missing_positional(true)

TrailingVarArg

Deprecated, replaced with Command::trailing_var_arg and Command::is_trailing_var_arg_set

Derive: replace #[clap(setting = TrailingVarArg)] with #[clap(trailing_var_arg = true)]

Builder: replace cmd.setting(TrailingVarArg) with cmd.trailing_var_arg(true)

DontDelimitTrailingValues

Deprecated, replaced with Command::dont_delimit_trailing_values and Command::is_dont_delimit_trailing_values_set

Derive: replace #[clap(setting = DontDelimitTrailingValues)] with #[clap(dont_delimit_trailing_values = true)]

Builder: replace cmd.setting(DontDelimitTrailingValues) with cmd.dont_delimit_trailing_values(true)

InferLongArgs

Deprecated, replaced with Command::infer_long_args

Derive: replace #[clap(setting = InferLongArgs)] with #[clap(infer_long_args = true)]

Builder: replace cmd.setting(InferLongArgs) with cmd.infer_long_args(true)

InferSubcommands

Deprecated, replaced with Command::infer_subcommands

Derive: replace #[clap(setting = InferSubcommands)] with #[clap(infer_subcommands = true)]

Builder: replace cmd.setting(InferSubcommands) with cmd.infer_subcommands(true)

SubcommandRequired

Deprecated, replaced with Command::subcommand_required and Command::is_subcommand_required_set

Derive: replace #[clap(setting = SubcommandRequired)] with #[clap(subcommand_required = true)]

Builder: replace cmd.setting(SubcommandRequired) with cmd.subcommand_required(true)

SubcommandRequiredElseHelp

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

Derive: replace #[clap(setting = SubcommandRequiredElseHelp)] with #[clap(subcommand_required = true, arg_required_else_help = true)]

Builder: replace cmd.setting(SubcommandRequiredElseHelp) with cmd.subcommand_required(true).arg_required_else_help(true)

AllowExternalSubcommands

Deprecated, replaced with Command::allow_external_subcommands and Command::is_allow_external_subcommands_set

Derive: replace #[clap(setting = AllowExternalSubcommands)] with #[clap(allow_external_subcommands = true)]

Builder: replace cmd.setting(AllowExternalSubcommands) with cmd.allow_external_subcommands(true)

Multicall

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

Derive: replace #[clap(setting = Multicall)] with #[clap(multicall = true)]

Builder: replace cmd.setting(Multicall) with cmd.multicall(true)

AllowInvalidUtf8ForExternalSubcommands

Deprecated, replaced with Command::allow_invalid_utf8_for_external_subcommands and Command::is_allow_invalid_utf8_for_external_subcommands_set

Derive: replace #[clap(setting = AllowInvalidUtf8ForExternalSubcommands)] with #[clap(allow_invalid_utf8_for_external_subcommands = true)]

Builder: replace cmd.setting(AllowInvalidUtf8ForExternalSubcommands) with cmd.allow_invalid_utf8_for_external_subcommands(true)

UseLongFormatForHelpSubcommand

Deprecated, this is now the default

Derive: remove #[clap(setting = UseLongFormatForHelpSubcommand)]

Builder: remove cmd.setting(UseLongFormatForHelpSubcommand)

SubcommandsNegateReqs

Deprecated, replaced with Command::subcommand_negates_reqs and Command::is_subcommand_negates_reqs_set

Derive: replace #[clap(setting = SubcommandsNegateReqs)] with #[clap(subcommand_negates_reqs = true)]

Builder: replace cmd.setting(SubcommandsNegateReqs) with cmd.subcommand_negates_reqs(true)

ArgsNegateSubcommands

Deprecated, replaced with Command::args_conflicts_with_subcommands and Command::is_args_conflicts_with_subcommands_set

Derive: replace #[clap(setting = ArgsNegateSubcommands)] with #[clap(args_conflicts_with_subcommands = true)]

Builder: replace cmd.setting(ArgsNegateSubcommands) with cmd.args_conflicts_with_subcommands(true)

SubcommandPrecedenceOverArg

Deprecated, replaced with Command::subcommand_precedence_over_arg and Command::is_subcommand_precedence_over_arg_set

Derive: replace #[clap(setting = SubcommandPrecedenceOverArg)] with #[clap(subcommand_precedence_over_arg = true)]

Builder: replace cmd.setting(SubcommandPrecedenceOverArg) with cmd.subcommand_precedence_over_arg(true)

ArgRequiredElseHelp

Deprecated, replaced with Command::arg_required_else_help and Command::is_arg_required_else_help_set

Derive: replace #[clap(setting = ArgRequiredElseHelp)] with #[clap(arg_required_else_help = true)]

Builder: replace cmd.setting(ArgRequiredElseHelp) with cmd.arg_required_else_help(true)

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

Deprecated, replaced with Command::dont_collapse_args_in_usage and Command::is_dont_collapse_args_in_usage_set

Derive: replace #[clap(setting = DontCollapseArgsInUsage)] with #[clap(dont_collapse_args_in_usage = true)]

Builder: replace cmd.setting(DontCollapseArgsInUsage) with cmd.dont_collapse_args_in_usage(true)

NextLineHelp

Deprecated, replaced with Command::next_line_help and Command::is_next_line_help_set

Derive: replace #[clap(setting = NextLineHelp)] with #[clap(next_line_help = true)]

Builder: replace cmd.setting(NextLineHelp) with cmd.next_line_help(true)

DisableColoredHelp

Deprecated, replaced with Command::disable_colored_help and Command::is_disable_colored_help_set

Derive: replace #[clap(setting = DisableColoredHelp)] with #[clap(disable_colored_help = true)]

Builder: replace cmd.setting(DisableColoredHelp) with cmd.disable_colored_help(true)

DisableHelpFlag

Deprecated, replaced with Command::disable_help_flag and Command::is_disable_help_flag_set

Derive: replace #[clap(setting = DisableHelpFlag)] with #[clap(disable_help_flag = true)]

Builder: replace cmd.setting(DisableHelpFlag) with cmd.disable_help_flag(true)

DisableHelpSubcommand

Deprecated, replaced with Command::disable_help_subcommand and Command::is_disable_help_subcommand_set

Derive: replace #[clap(setting = DisableHelpSubcommand)] with #[clap(disable_help_subcommand = true)]

Builder: replace cmd.setting(DisableHelpSubcommand) with cmd.disable_help_subcommand(true)

DisableVersionFlag

Deprecated, replaced with Command::disable_version_flag and Command::is_disable_version_flag_set

Derive: replace #[clap(setting = DisableVersionFlag)] with #[clap(disable_version_flag = true)]

Builder: replace cmd.setting(DisableVersionFlag) with cmd.disable_version_flag(true)

PropagateVersion

Deprecated, replaced with Command::propagate_version and Command::is_propagate_version_set

Derive: replace #[clap(setting = PropagateVersion)] with #[clap(propagate_version = true)]

Builder: replace cmd.setting(PropagateVersion) with cmd.propagate_version(true)

Hidden

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

Derive: replace #[clap(setting = Hidden)] with #[clap(hide = true)]

Builder: replace cmd.setting(Hidden) with cmd.hide(true)

HidePossibleValues

Deprecated, replaced with Command::hide_possible_values and Arg::is_hide_possible_values_set

Derive: replace #[clap(setting = HidePossibleValues)] with #[clap(hide_possible_values = true)]

Builder: replace cmd.setting(HidePossibleValues) with cmd.hide_possible_values(true)

HelpExpected

Deprecated, replaced with Command::help_expected

Derive: replace #[clap(setting = HelpExpected)] with #[clap(help_expected = true)]

Builder: replace cmd.setting(HelpExpected) with cmd.help_expected(true)

NoBinaryName

Deprecated, replaced with Command::no_binary_name

Derive: replace #[clap(setting = NoBinaryName)] with #[clap(no_binary_name = true)]

Builder: replace cmd.setting(NoBinaryName) with cmd.no_binary_name(true)

NoAutoHelp

Deprecated, replaced with Arg::action

Derive: replace #[clap(setting = NoAutoHelp)] with setting an explicit action on your help argument

Builder: replace cmd.setting(NoAutoHelp) with setting an explicit action on your help argument

NoAutoVersion

Deprecated, replaced with Arg::action

Derive: replace #[clap(setting = NoAutoVersion)] with setting an explicit action on your version argument

Builder: replace cmd.setting(NoAutoVersion) with setting an explicit action on your version argument

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

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.