pub struct CommandContext {
pub subcommand: String,
pub positionals: Vec<String>,
pub flags: HashMap<String, String>,
}Expand description
Holds the parsed context for a command invocation.
Passed by reference to every command handler. Contains the resolved subcommand name, any positional arguments (non-flag tokens), and the full set of flags after alias resolution. Global flags registered on the app are merged in alongside command-specific flags.
Fields§
§subcommand: StringThe subcommand name as typed by the user.
positionals: Vec<String>Positional arguments, in order, with flags filtered out.
flags: HashMap<String, String>Resolved flags, keyed by canonical name. Boolean flags have the value "true".
Includes both command-specific flags and any global flags that were passed.
Auto Trait Implementations§
impl Freeze for CommandContext
impl RefUnwindSafe for CommandContext
impl Send for CommandContext
impl Sync for CommandContext
impl Unpin for CommandContext
impl UnsafeUnpin for CommandContext
impl UnwindSafe for CommandContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more