diff --git a/clap_builder/src/builder/arg.rs b/clap_builder/src/builder/arg.rs index b5450d16e35..ec5444cb994 100644 --- a/clap_builder/src/builder/arg.rs +++ b/clap_builder/src/builder/arg.rs @@ -3870,6 +3870,12 @@ impl Arg { self.long_help.as_ref() } + /// Get the placement within help + #[inline] + pub fn get_display_order(&self) -> usize { + self.disp_ord.unwrap_or(999) + } + /// Get the help heading specified for this argument, if any #[inline] pub fn get_help_heading(&self) -> Option<&str> { @@ -4422,11 +4428,6 @@ impl Arg { pub(crate) fn is_multiple(&self) -> bool { self.is_multiple_values_set() || matches!(*self.get_action(), ArgAction::Append) } - - #[cfg(feature = "help")] - pub(crate) fn get_display_order(&self) -> usize { - self.disp_ord.unwrap_or(999) - } } impl From<&'_ Arg> for Arg { diff --git a/clap_builder/src/builder/command.rs b/clap_builder/src/builder/command.rs index 32e6ea4fb0f..d050e4943bd 100644 --- a/clap_builder/src/builder/command.rs +++ b/clap_builder/src/builder/command.rs @@ -3462,6 +3462,12 @@ impl Command { self.long_version.as_deref() } + /// Get the placement within help + #[inline] + pub fn get_display_order(&self) -> usize { + self.disp_ord.unwrap_or(999) + } + /// Get the authors of the cmd. #[inline] pub fn get_author(&self) -> Option<&str> { @@ -4777,11 +4783,6 @@ impl Command { .map(|sc| sc.get_name()) } - #[cfg(feature = "help")] - pub(crate) fn get_display_order(&self) -> usize { - self.disp_ord.unwrap_or(999) - } - pub(crate) fn write_help_err(&self, mut use_long: bool) -> StyledStr { debug!( "Command::write_help_err: {}, use_long={:?}",