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

pub struct Verb {
    pub names: Vec<String>,
    pub keys: Vec<KeyEvent>,
    pub keys_desc: String,
    pub execution: VerbExecution,
    pub description: VerbDescription,
    pub selection_condition: SelectionType,
}

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

execution: VerbExecution

How the verb will be executed

description: VerbDescription

a description

selection_condition: SelectionType

the type of selection this verb applies to

Implementations

impl Verb[src]

pub fn new(
    name: Option<String>,
    execution: VerbExecution,
    description: VerbDescription
) -> Self
[src]

pub fn internal(internal: Internal) -> Self[src]

pub fn internal_bang(internal: Internal) -> Self[src]

pub fn external(
    invocation_str: &str,
    execution_str: &str,
    exec_mode: ExternalExecutionMode
) -> Result<Self, ConfError>
[src]

pub fn with_key(self, key: KeyEvent) -> 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 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 Clone for Verb[src]

impl Debug for Verb[src]

impl From<ExternalExecution> for Verb[src]

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

type Error = ConfError

The type returned in the event of a conversion error.

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.