[][src]Struct broot::verbs::Verb

pub struct Verb {
    pub invocation: VerbInvocation,
    pub key: Option<KeyEvent>,
    pub key_desc: String,
    pub args_parser: Option<Regex>,
    pub shortcut: Option<String>,
    pub execution: String,
    pub description: Option<String>,
    pub from_shell: bool,
    pub leave_broot: bool,
    pub confirm: bool,
    pub selection_condition: SelectionType,
}

what makes a verb.

There are two types of verbs executions:

  • external programs or commands (cd, mkdir, user defined commands, etc.)
  • built in behaviors (focusing a path, going back, showing the help, etc.)

Fields

invocation: VerbInvocationkey: Option<KeyEvent>key_desc: Stringargs_parser: Option<Regex>shortcut: Option<String>execution: Stringdescription: Option<String>from_shell: boolleave_broot: boolconfirm: boolselection_condition: SelectionType

Implementations

impl Verb[src]

pub fn create_external(
    invocation_str: &str,
    key: Option<KeyEvent>,
    shortcut: Option<String>,
    execution: String,
    description: Option<String>,
    from_shell: bool,
    leave_broot: bool,
    confirm: bool
) -> Result<Verb, ConfError>
[src]

build a verb using standard configurable behavior. "external" means not "built-in".

pub fn create_builtin(
    name: &str,
    key: Option<KeyEvent>,
    shortcut: Option<String>,
    description: &str
) -> Verb
[src]

built-ins are verbs offering a logic other than the execution based on exec_pattern. They mostly modify the appstate

pub fn match_error(&self, invocation: &VerbInvocation) -> Option<String>[src]

Assuming the verb has been matched, check whether the arguments are OK according to the regex. Return none when there's no problem and return the error to display if arguments don't match

pub fn write_status(
    &self,
    w: &mut impl Write,
    task: Option<&'static str>,
    path: PathBuf,
    invocation: &VerbInvocation,
    screen: &Screen
) -> Result<(), ProgramError>
[src]

pub fn to_cmd_result(
    &self,
    file: &Path,
    args: &Option<String>,
    _screen: &mut Screen,
    con: &AppContext
) -> Result<AppStateCmdResult, ProgramError>
[src]

build the cmd result for a verb defined with an exec pattern. Calling this function on a built-in doesn't make sense

pub fn exec_token(&self, file: &Path, args: &Option<String>) -> Vec<String>[src]

build the token which can be used to launch en executable. This doesn't make sense for a built-in.

pub fn shell_exec_string(&self, file: &Path, args: &Option<String>) -> String[src]

build a shell compatible command, with escapings

Trait Implementations

impl Clone for Verb[src]

impl Debug for Verb[src]

Auto Trait Implementations

impl !RefUnwindSafe for Verb

impl Send for Verb

impl Sync for Verb

impl Unpin for Verb

impl UnwindSafe for Verb

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.