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,
// 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
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
Deprecated, replaced with Command::allow_hyphen_values
and
Arg::is_allow_hyphen_values_set
AllowNegativeNumbers
Deprecated, replaced with Command::allow_negative_numbers
and
Command::is_allow_negative_numbers_set
AllArgsOverrideSelf
Deprecated, replaced with Command::args_override_self
AllowMissingPositional
Deprecated, replaced with Command::allow_missing_positional
and
Command::is_allow_missing_positional_set
TrailingVarArg
Deprecated, replaced with Command::trailing_var_arg
and Command::is_trailing_var_arg_set
DontDelimitTrailingValues
Deprecated, replaced with Command::dont_delimit_trailing_values
and
Command::is_dont_delimit_trailing_values_set
InferLongArgs
Deprecated, replaced with Command::infer_long_args
InferSubcommands
Deprecated, replaced with Command::infer_subcommands
SubcommandRequired
Deprecated, replaced with Command::subcommand_required
and
Command::is_subcommand_required_set
SubcommandRequiredElseHelp
Deprecated, replaced with Command::subcommand_required
combined with
Command::arg_required_else_help
.
AllowExternalSubcommands
Deprecated, replaced with Command::allow_external_subcommands
and
Command::is_allow_external_subcommands_set
Multicall
Deprecated, replaced with Command::multicall
and Command::is_multicall_set
AllowInvalidUtf8ForExternalSubcommands
Deprecated, replaced with Command::allow_invalid_utf8_for_external_subcommands
and Command::is_allow_invalid_utf8_for_external_subcommands_set
UseLongFormatForHelpSubcommand
Deprecated, this is now the default
SubcommandsNegateReqs
Deprecated, replaced with Command::subcommand_negates_reqs
and
Command::is_subcommand_negates_reqs_set
ArgsNegateSubcommands
Deprecated, replaced with Command::args_conflicts_with_subcommands
and
Command::is_args_conflicts_with_subcommands_set
SubcommandPrecedenceOverArg
Deprecated, replaced with Command::subcommand_precedence_over_arg
and
Command::is_subcommand_precedence_over_arg_set
ArgRequiredElseHelp
Deprecated, replaced with Command::arg_required_else_help
and
Command::is_arg_required_else_help_set
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
NextLineHelp
Deprecated, replaced with Command::next_line_help
and Command::is_next_line_help_set
DisableColoredHelp
Deprecated, replaced with Command::disable_colored_help
and
Command::is_disable_colored_help_set
DisableHelpFlag
Deprecated, replaced with Command::disable_help_flag
and Command::is_disable_help_flag_set
DisableHelpSubcommand
Deprecated, replaced with Command::disable_help_subcommand
and
Command::is_disable_help_subcommand_set
DisableVersionFlag
Deprecated, replaced with Command::disable_version_flag
and
Command::is_disable_version_flag_set
PropagateVersion
Deprecated, replaced with Command::propagate_version
and Command::is_propagate_version_set
Hidden
Deprecated, replaced with Command::hide
and Command::is_hide_set
HidePossibleValues
Deprecated, replaced with Command::hide_possible_values
and
Arg::is_hide_possible_values_set
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
sourceimpl BitOr<AppSettings> for AppSettings
impl BitOr<AppSettings> for AppSettings
sourceimpl Clone for AppSettings
impl Clone for AppSettings
sourcefn clone(&self) -> AppSettings
fn clone(&self) -> AppSettings
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for AppSettings
impl Debug for AppSettings
sourceimpl PartialEq<AppSettings> for AppSettings
impl PartialEq<AppSettings> for AppSettings
impl Copy for AppSettings
impl StructuralPartialEq for AppSettings
Auto Trait Implementations
impl RefUnwindSafe for AppSettings
impl Send for AppSettings
impl Sync for AppSettings
impl Unpin for AppSettings
impl UnwindSafe for AppSettings
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more