mirror of
https://github.com/clap-rs/clap
synced 2025-01-18 23:53:54 +00:00
feat(builder): Expose get_display_order
This commit is contained in:
parent
67d9fef9ce
commit
c6b5d627a0
2 changed files with 12 additions and 10 deletions
|
@ -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 {
|
||||
|
|
|
@ -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={:?}",
|
||||
|
|
Loading…
Reference in a new issue