pub struct Verb {
    pub names: Vec<String>,
    pub keys: Vec<KeyEvent>,
    pub keys_desc: String,
    pub invocation_parser: Option<InvocationParser>,
    pub execution: VerbExecution,
    pub description: VerbDescription,
    pub selection_condition: SelectionType,
    pub file_extensions: Vec<String>,
    pub needs_selection: bool,
    pub needs_another_panel: bool,
    pub auto_exec: bool,
    pub show_in_doc: bool,
}
Expand description

what makes a verb.

Verbs are the engines of broot commands, and apply

  • to the selected file (if user-defined, then must contain {file}, {parent} or {directory})
  • to the current app state There are two types of verbs executions:
  • external programs or commands (cd, mkdir, user defined commands, etc.)
  • internal behaviors (focusing a path, going back, showing the help, etc.) Some verbs are builtins, some other ones are created by configuration. Both builtins and configured vers can be internal or external based.

Verbs can’t be cloned. Two verbs are equal if they have the same address in memory.

Fields

names: Vec<String>

names (like “cd”, “focus”, “focus_tab”, “c”) by which a verb can be called. Can be empty if the verb is only called with a key shortcut. Right now there’s no way for it to contain more than 2 elements but this may change.

keys: Vec<KeyEvent>

key shortcuts

keys_desc: String

description of the optional keyboard key(s) triggering that verb

invocation_parser: Option<InvocationParser>

how the input must be checked and interpreted Can be empty if the verb is only called with a key shortcut.

execution: VerbExecution

how the verb will be executed

description: VerbDescription

a description

selection_condition: SelectionType

the type of selection this verb applies to

file_extensions: Vec<String>

extension filtering. If empty, all extensions apply

needs_selection: bool

whether the verb needs a selection

needs_another_panel: bool

whether we need to have a secondary panel for execution (which is the case when the execution pattern has {other-panel-file})

auto_exec: bool

if true (default) verbs are directly executed when triggered with a keyboard shortcut

show_in_doc: bool

whether to show the verb in help screen (if we show all input related actions, the doc is unusable)

Implementations

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.

Trait Implementations

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.