Cli

Struct Cli 

Source
pub(crate) struct Cli {
Show 21 fields pub(crate) dry_run: bool, pub(crate) verbose: bool, pub(crate) all: bool, pub(crate) depth: Option<i32>, pub(crate) size: Option<String>, pub(crate) mtime: Option<String>, pub(crate) perm: Option<String>, pub(crate) user: Option<String>, pub(crate) group: Option<String>, pub(crate) type_filter: Option<char>, pub(crate) exclude: Option<String>, pub(crate) stop_on_error: bool, pub(crate) confirm: bool, pub(crate) list_all: bool, pub(crate) jobs: i32, pub(crate) shell: String, pub(crate) args: Vec<String>, pub(crate) glob: bool, pub(crate) regex_match: bool, pub(crate) glob_exclude: bool, pub(crate) expr: Option<String>,
}
Expand description

Command-line interface definition using clap derive macros.

This struct defines every flag and option that shell-cmd-rs accepts. Positional arguments (path, command, regex, extras) are collected into the args field via trailing_var_arg.

§Compatibility

The short flags, long flags, and their semantics are identical to the original C++ shell-cmd to ensure drop-in compatibility.

Fields§

§dry_run: bool

Dry-run, print commands without executing

§verbose: bool

Verbose, print each command before running

§all: bool

Include hidden files/directories

§depth: Option<i32>

Max recursion depth (0 = current dir only)

§size: Option<String>

Filter by size: +10M (>10MB), -1K (<1KB), 4096 (exactly 4096 bytes). Suffixes: K, M, G

§mtime: Option<String>

Filter by modification time: +7 (older than 7 days), -1 (modified within last day), 3 (exactly 3 days)

§perm: Option<String>

Filter by permissions (octal), e.g. 755

§user: Option<String>

Filter by owner username

§group: Option<String>

Filter by group name

§type_filter: Option<char>

Filter by type: f (file), d (directory), l (symlink)

§exclude: Option<String>

Exclude files/directories matching REGEX

§stop_on_error: bool

Stop on first command failure

§confirm: bool

Prompt for confirmation before each command

§list_all: bool

Collect all matches and run command once with %0 = all matched paths

§jobs: i32

Run N commands in parallel (default: 1)

§shell: String

Shell to use for execution (default: /bin/bash)

§args: Vec<String>

Positional args: path “command” regex [extra_args..]

§glob: bool

Treat pattern as a glob (*, ?) instead of regex

§regex_match: bool

Use regex-match (entire path must match) instead of regex-search (substring match)

§glob_exclude: bool

Treat exclude pattern as a glob (*, ?) instead of regex

§expr: Option<String>

Expression filter: compose glob(), regex(), regex_match() with and/or/not

Trait Implementations§

Source§

impl Args for Cli

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl CommandFactory for Cli

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl FromArgMatches for Cli

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Cli

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl Freeze for Cli

§

impl RefUnwindSafe for Cli

§

impl Send for Cli

§

impl Sync for Cli

§

impl Unpin for Cli

§

impl UnwindSafe for Cli

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.