Skip to main content

Command

Struct Command 

Source
pub struct Command {
    pub side: Option<PanelSide>,
    pub roots: Vec<PathBuf>,
    pub reveal: Vec<PathBuf>,
    pub hidden: bool,
    pub width: Option<WidthArg>,
}
Expand description

What a tree-space invocation wants the panel to do.

Fields§

§side: Option<PanelSide>

An explicit --side override. Absent means “use the configured side”.

§roots: Vec<PathBuf>

Directory roots to open as panes. Empty means this is a show/toggle.

§reveal: Vec<PathBuf>

Files (or paths) to reveal: each opens a pane rooted at its containing directory and selects the path once the pane is loaded. Populated by --select PATH and by positional arguments that name a non-directory.

§hidden: bool

--hidden: do everything else as usual, but ensure the panel ends up hidden — hide it if showing, leave it hidden if already hidden, and start hidden when this launches the panel.

§width: Option<WidthArg>

--width: resize the panel (absolute or relative) without touching its visibility.

Implementations§

Source§

impl Command

Source

pub fn parse<I, S>(args: I) -> Self
where I: IntoIterator<Item = S>, S: Into<OsString>,

Parse the arguments of a tree-space invocation (everything after argv[0], as OsStrings). Only arguments that are existing directories become roots; --side left|right (or --side=left|right) selects the side override. Unknown flags are ignored for forward compatibility.

Source

pub fn encode(&self) -> String

Encode into the IPC wire format (a single line, NUL-separated tokens).

Source

pub fn decode(line: &str) -> Option<Command>

Decode a line from the IPC wire format back into a Command. An empty (or whitespace-only) line decodes to a plain toggle.

Source

pub fn is_toggle(&self) -> bool

Does this command carry no directories and ask for the normal toggle (neither a side override, --hidden, nor --width)?

Source

pub fn reveal_targets(&self) -> Vec<(PathBuf, Option<PathBuf>)>

Resolve each reveal path into a pane root plus an optional child to select. A directory (or the current directory .) opens as its own root with nothing to select; a file opens a pane rooted at its parent directory and selects the file. A path with no parent component (e.g. /) is skipped.

Trait Implementations§

Source§

impl Clone for Command

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Command

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Command

Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Command

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<C> AsyncPosition<()> for C

Source§

fn position(_index: usize)

Returns the position. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<C, I> Position<(), I> for C

Source§

fn position(&self, _index: &I)

Returns the position. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more