pub struct ResolvedCommand {
pub arguments: Vec<OsString>,
pub subcommand_index: usize,
pub subcommand: Option<OsString>,
pub route: Route,
}Expand description
What:
The resolved command:
the arguments after expansion,
where the subcommand is,
its
name,
and the route.
Why:
ResolvedGitCommand.
In TS you’d write (pseudocode):
type ResolvedGitCommand = { args: string[]; subcommandIndex: number; subcommand?: string; route: ForwardedCommandRoute };Fields§
§arguments: Vec<OsString>Arguments after expansion, global options included.
subcommand_index: usizeIndex of the subcommand in arguments.
subcommand: Option<OsString>The subcommand,
or nothing for a bare git or a help,
version or error form.
route: RouteHow it was reached.
Implementations§
Source§impl ResolvedCommand
Methods over a resolved command.
impl ResolvedCommand
Methods over a resolved command.
Sourcepub fn word(&self) -> &[u8] ⓘ
pub fn word(&self) -> &[u8] ⓘ
What: The subcommand as bytes, empty when there is none. Why: Classification compares names.
In TS you’d write (pseudocode):
command.subcommand ?? ''Sourcepub fn region(&self) -> &[OsString]
pub fn region(&self) -> &[OsString]
What: The arguments after the subcommand. Why: Option classification reads them.
In TS you’d write (pseudocode):
command.args.slice(command.subcommandIndex + 1)Sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
What: Whether this is a built-in reached directly or through aliases. Why: Shell aliases and unresolved names are never index writers or commits.
In TS you’d write (pseudocode):
command.route !== 'shell-alias' && command.route !== 'unresolved' && command.subcommand !== undefinedTrait Implementations§
Source§impl Clone for ResolvedCommand
impl Clone for ResolvedCommand
Source§impl Debug for ResolvedCommand
impl Debug for ResolvedCommand
impl Eq for ResolvedCommand
Source§impl PartialEq for ResolvedCommand
impl PartialEq for ResolvedCommand
impl StructuralPartialEq for ResolvedCommand
Auto Trait Implementations§
impl Freeze for ResolvedCommand
impl RefUnwindSafe for ResolvedCommand
impl Send for ResolvedCommand
impl Sync for ResolvedCommand
impl Unpin for ResolvedCommand
impl UnsafeUnpin for ResolvedCommand
impl UnwindSafe for ResolvedCommand
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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