pub struct ParseOutput {
pub cmd: SpecCommand,
pub cmds: Vec<SpecCommand>,
pub args: IndexMap<Arc<SpecArg>, ParseValue>,
pub flags: IndexMap<Arc<SpecFlag>, ParseValue>,
pub available_flags: BTreeMap<String, Arc<SpecFlag>>,
pub flag_awaiting_value: Vec<Arc<SpecFlag>>,
pub errors: Vec<UsageErr>,
pub next_arg: Option<Arc<SpecArg>>,
pub double_dash_seen: bool,
}Fields§
§cmd: SpecCommand§cmds: Vec<SpecCommand>§args: IndexMap<Arc<SpecArg>, ParseValue>§flags: IndexMap<Arc<SpecFlag>, ParseValue>§available_flags: BTreeMap<String, Arc<SpecFlag>>Every flag the parser recognizes at this point, keyed by each of its aliases
(--long, -s, negations).
This includes flags that only remain recognized because they may appear before a
mounted command — see ParseOutput::completion_flags for the set a completion
should offer.
flag_awaiting_value: Vec<Arc<SpecFlag>>§errors: Vec<UsageErr>§next_arg: Option<Arc<SpecArg>>The positional argument the next word would have filled, i.e. where the parser’s
cursor stopped. None once every argument is satisfied.
Completions need exactly this: the parser already accounts for var_max, for
restart_token rewinds, and for the jump an explicit -- performs onto a
double_dash="required" argument, so re-deriving it from args would disagree.
double_dash_seen: boolWhether an explicit -- was consumed as a separator.
A -- that double_dash="preserve" keeps as a value does not count: it is a value
of the variadic argument collecting it, not a separator, so it does not unlock a
double_dash="required" argument.
Implementations§
Source§impl ParseOutput
impl ParseOutput
Sourcepub fn completion_flags(&self) -> BTreeMap<String, Arc<SpecFlag>>
pub fn completion_flags(&self) -> BTreeMap<String, Arc<SpecFlag>>
The flags a completion should offer for the parsed command.
Usually every recognized flag, i.e. ParseOutput::available_flags. Once a mounted
command has been reached, though, the commands above it belong to the mounting CLI and
their flags are not accepted there — mise, for example, forwards everything after a task
name to the task itself — so only the flags declared from the mount boundary down are
offered. Those globals stay in available_flags because they may legitimately appear
before the mounted command.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ParseOutput
impl !RefUnwindSafe for ParseOutput
impl !UnwindSafe for ParseOutput
impl Send for ParseOutput
impl Sync for ParseOutput
impl Unpin for ParseOutput
impl UnsafeUnpin for ParseOutput
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more