Skip to content

Commit

Permalink
feat: Publicly expose Id
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 12, 2022
1 parent 43ca9a2 commit 004de00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -108,6 +108,7 @@ pub use crate::util::color::ColorChoice;
#[cfg(not(feature = "color"))]
#[allow(unused_imports)]
pub(crate) use crate::util::color::ColorChoice;
pub use crate::util::Id;

pub use crate::derive::{Args, CommandFactory, FromArgMatches, Parser, Subcommand, ValueEnum};

Expand Down
6 changes: 6 additions & 0 deletions src/util/id.rs
@@ -1,3 +1,8 @@
/// [`Arg`][crate::Arg] or [`ArgGroup`][crate::ArgGroup] identifier
///
/// This is used for accessing the value in [`ArgMatches`][crate::ArgMatches] or defining
/// relationships between `Arg`s and `ArgGroup`s with functions like
/// [`Arg::conflicts_with`][crate::Arg::conflicts_with].
#[derive(Default, Clone, Eq, PartialEq, PartialOrd, Ord, Hash)]
pub struct Id {
name: Inner,
Expand Down Expand Up @@ -26,6 +31,7 @@ impl Id {
}
}

/// Get the raw string of the `Id`
pub fn as_str(&self) -> &str {
self.name.as_str()
}
Expand Down
4 changes: 3 additions & 1 deletion src/util/mod.rs
Expand Up @@ -6,13 +6,15 @@ mod graph;
mod id;
mod str_to_bool;

pub use self::id::Id;

pub(crate) use self::flat_map::Entry;
pub(crate) use self::flat_map::FlatMap;
pub(crate) use self::flat_set::FlatSet;
pub(crate) use self::graph::ChildGraph;
pub(crate) use self::str_to_bool::str_to_bool;
pub(crate) use self::str_to_bool::FALSE_LITERALS;
pub(crate) use self::str_to_bool::TRUE_LITERALS;
pub(crate) use self::{graph::ChildGraph, id::Id};

pub(crate) mod color;

Expand Down

0 comments on commit 004de00

Please sign in to comment.