Skip to content

Commit c6b5d62

Browse files
committed
feat(builder): Expose get_display_order
1 parent 67d9fef commit c6b5d62

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

clap_builder/src/builder/arg.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3870,6 +3870,12 @@ impl Arg {
38703870
self.long_help.as_ref()
38713871
}
38723872

3873+
/// Get the placement within help
3874+
#[inline]
3875+
pub fn get_display_order(&self) -> usize {
3876+
self.disp_ord.unwrap_or(999)
3877+
}
3878+
38733879
/// Get the help heading specified for this argument, if any
38743880
#[inline]
38753881
pub fn get_help_heading(&self) -> Option<&str> {
@@ -4422,11 +4428,6 @@ impl Arg {
44224428
pub(crate) fn is_multiple(&self) -> bool {
44234429
self.is_multiple_values_set() || matches!(*self.get_action(), ArgAction::Append)
44244430
}
4425-
4426-
#[cfg(feature = "help")]
4427-
pub(crate) fn get_display_order(&self) -> usize {
4428-
self.disp_ord.unwrap_or(999)
4429-
}
44304431
}
44314432

44324433
impl From<&'_ Arg> for Arg {

clap_builder/src/builder/command.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,6 +3462,12 @@ impl Command {
34623462
self.long_version.as_deref()
34633463
}
34643464

3465+
/// Get the placement within help
3466+
#[inline]
3467+
pub fn get_display_order(&self) -> usize {
3468+
self.disp_ord.unwrap_or(999)
3469+
}
3470+
34653471
/// Get the authors of the cmd.
34663472
#[inline]
34673473
pub fn get_author(&self) -> Option<&str> {
@@ -4777,11 +4783,6 @@ impl Command {
47774783
.map(|sc| sc.get_name())
47784784
}
47794785

4780-
#[cfg(feature = "help")]
4781-
pub(crate) fn get_display_order(&self) -> usize {
4782-
self.disp_ord.unwrap_or(999)
4783-
}
4784-
47854786
pub(crate) fn write_help_err(&self, mut use_long: bool) -> StyledStr {
47864787
debug!(
47874788
"Command::write_help_err: {}, use_long={:?}",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy