pub struct Complete {
pub raw: Option<String>,
pub position: Option<usize>,
pub cmd: Vec<String>,
}
Expand description
A clap
-compatible struct that can be used to generate completions for the
current CLI invocation.
Fields§
§raw: Option<String>
A single string corresponding to the raw CLI invocation.
e.g: $ my-command $((1 + 2)) b<TAB>ar baz
would pass --raw "my-command $((1 + 2)) bar baz"
.
Note the significant whitespace!
May not always be available, depending on the shell.
position: Option<usize>
The cursor’s position within the raw CLI invocation.
e.g: $ my-command $((1 + 2)) b<TAB>ar baz
would pass --position 25
May not always be available, depending on the shell.
cmd: Vec<String>
A list of strings corresponding to how the shell has interpreted the current command.
e.g: $ my-command foo $((1 + 2)) bar
would pass -- my-command foo 3 bar
.
Implementations§
Source§impl Complete
impl Complete
Sourcepub async fn println_to_stub_script<Cli: CommandFactory>(
self,
maybe_subcommand_of: Option<&str>,
custom_completer_factory: impl CustomCompleterFactory,
)
pub async fn println_to_stub_script<Cli: CommandFactory>( self, maybe_subcommand_of: Option<&str>, custom_completer_factory: impl CustomCompleterFactory, )
Generate completions for the given clap
command, and prints them to
stdout in the format the built-in stub scripts expect.
See Complete::generate_completions
for more info.
Sourcepub async fn generate_completions<Cli: CommandFactory>(
self,
maybe_subcommand_of: Option<&str>,
custom_completer_factory: impl CustomCompleterFactory,
) -> Vec<String>
pub async fn generate_completions<Cli: CommandFactory>( self, maybe_subcommand_of: Option<&str>, custom_completer_factory: impl CustomCompleterFactory, ) -> Vec<String>
Generate completions for the given clap
command.
Set maybe_subcommand_of
to the root command’s value if the binary may
be invoked as subcommand. e.g: if the binary is invoked as cargo xtask
, pass Some("cargo")
.
Trait Implementations§
Source§impl Args for Complete
impl Args for Complete
Source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id
][crate::ArgGroup::id] for this set of argumentsSource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command
] so it can instantiate self
via
[FromArgMatches::update_from_arg_matches_mut
] Read moreSource§impl FromArgMatches for Complete
impl FromArgMatches for Complete
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.