Enum clap::builder::AppSettings
source · #[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,
}
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
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§
source§impl BitOr for AppSettings
impl BitOr for AppSettings
source§impl Clone for AppSettings
impl Clone for AppSettings
source§fn clone(&self) -> AppSettings
fn clone(&self) -> AppSettings
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AppSettings
impl Debug for AppSettings
source§impl PartialEq for AppSettings
impl PartialEq for AppSettings
impl Copy for AppSettings
impl StructuralPartialEq for AppSettings
Auto Trait Implementations§
impl Freeze for AppSettings
impl RefUnwindSafe for AppSettings
impl Send for AppSettings
impl Sync for AppSettings
impl Unpin for AppSettings
impl UnwindSafe for AppSettings
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)