[][src]Struct broot::verb::Verb

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 need_another_panel: bool,
}

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.

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

need_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})

Implementations

impl Verb[src]

pub fn new(
    invocation_str: Option<&str>,
    execution: VerbExecution,
    description: VerbDescription
) -> Result<Self, ConfError>
[src]

pub fn with_key(self, key: KeyEvent) -> Self[src]

pub fn with_alt_key(self, chr: char) -> Self[src]

pub fn with_control_key(self, chr: char) -> Self[src]

pub fn with_description(self, description: &str) -> Self[src]

pub fn with_shortcut(self, shortcut: &str) -> Self[src]

pub fn with_stype(self, stype: SelectionType) -> Self[src]

pub fn needing_another_panel(self) -> Self[src]

pub fn check_args(
    &self,
    invocation: &VerbInvocation,
    other_path: &Option<PathBuf>
) -> 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 get_status(
    &self,
    sel: Selection<'_>,
    other_path: &Option<PathBuf>,
    invocation: &VerbInvocation
) -> Status
[src]

pub fn get_arg_selection_type(&self) -> Option<SelectionType>[src]

in case the verb take only one argument of type path, return the selection type of this unique argument

pub fn get_arg_anchor(&self) -> PathAnchor[src]

pub fn get_internal(&self) -> Option<Internal>[src]

Trait Implementations

impl Debug for Verb[src]

impl<'_> TryFrom<&'_ VerbConf> for Verb[src]

read a deserialized verb conf item into a verb, checking a few basic things in the process

type Error = ConfError

The type returned in the event of a conversion error.

Auto Trait Implementations

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> Pointable for T

type Init = T

The type for initializers.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,