pub struct Spec {
pub options: GenerationOptions,
pub actions: Vec<CompleteAction>,
pub glob_pattern: Option<String>,
pub word_list: Option<String>,
pub function_name: Option<String>,
pub command: Option<String>,
pub filter_pattern: Option<String>,
pub filter_pattern_excludes: bool,
pub prefix: Option<String>,
pub suffix: Option<String>,
}Expand description
Encapsulates a command completion specification; provides policy for how to generate completions for a given input.
Fields§
§options: GenerationOptionsOptions to use for completion.
actions: Vec<CompleteAction>Actions to take to generate completions.
glob_pattern: Option<String>Optionally, a glob pattern whose expansion will be used as completions.
word_list: Option<String>Optionally, a list of words to use as completions.
function_name: Option<String>Optionally, the name of a shell function to invoke to generate completions.
command: Option<String>Optionally, the name of a command to execute to generate completions.
filter_pattern: Option<String>Optionally, a pattern to filter completions.
filter_pattern_excludes: boolIf true, completion candidates matching filter_pattern are removed;
otherwise, those not matching it are removed.
prefix: Option<String>Optionally, provides a prefix to be prepended to all completion candidates.
suffix: Option<String>Optionally, provides a suffix to be prepended to all completion candidates.
Implementations§
Source§impl Spec
impl Spec
Sourcepub async fn get_completions(
&self,
shell: &mut Shell,
context: &Context<'_>,
) -> Result<Answer, Error>
pub async fn get_completions( &self, shell: &mut Shell, context: &Context<'_>, ) -> Result<Answer, Error>
Generates completion candidates using this specification.
§Arguments
shell- The shell instance to use for completion generation.context- The context in which completion is being generated.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Spec
impl RefUnwindSafe for Spec
impl Send for Spec
impl Sync for Spec
impl Unpin for Spec
impl UnwindSafe for Spec
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<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