Trait CompletionInput

Source
pub trait CompletionInput: Sized {
    // Required methods
    fn args(&self) -> Vec<&str>;
    fn arg_index(&self) -> usize;
    fn char_index(&self) -> usize;

    // Provided methods
    fn current_word(&self) -> &str { ... }
    fn previous_word(&self) -> &str { ... }
    fn complete_subcommand<'a, T>(&self, subcommands: T) -> Vec<String>
       where T: IntoIterator<Item = &'a str> { ... }
    fn complete_directory(&self) -> Vec<String> { ... }
    fn complete_file(&self) -> Vec<String> { ... }
}

Required Methods§

Source

fn args(&self) -> Vec<&str>

Source

fn arg_index(&self) -> usize

Source

fn char_index(&self) -> usize

Provided Methods§

Source

fn current_word(&self) -> &str

Source

fn previous_word(&self) -> &str

Source

fn complete_subcommand<'a, T>(&self, subcommands: T) -> Vec<String>
where T: IntoIterator<Item = &'a str>,

Given a list of subcommands, print any that match the current word

Source

fn complete_directory(&self) -> Vec<String>

Print directory completions based on the current word

Source

fn complete_file(&self) -> Vec<String>

Print file completions based on the current word Also returns directories because the user may be entering a file within that directory

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§