pub struct BashRunner { /* private fields */ }
Expand description
Simple bash-like command runner
Implementations§
Source§impl BashRunner
impl BashRunner
Sourcepub fn ls(&self, path: Option<&str>, show_hidden: bool) -> Result<String>
pub fn ls(&self, path: Option<&str>, show_hidden: bool) -> Result<String>
List directory contents (like ls)
Sourcepub fn rm(&self, path: &str, recursive: bool, force: bool) -> Result<()>
pub fn rm(&self, path: &str, recursive: bool, force: bool) -> Result<()>
Remove files/directories (like rm)
Sourcepub fn cp(&self, source: &str, dest: &str, recursive: bool) -> Result<()>
pub fn cp(&self, source: &str, dest: &str, recursive: bool) -> Result<()>
Copy files/directories (like cp)
Sourcepub fn mv(&self, source: &str, dest: &str) -> Result<()>
pub fn mv(&self, source: &str, dest: &str) -> Result<()>
Move/rename files/directories (like mv)
Sourcepub fn grep(
&self,
pattern: &str,
path: Option<&str>,
recursive: bool,
) -> Result<String>
pub fn grep( &self, pattern: &str, path: Option<&str>, recursive: bool, ) -> Result<String>
Search for text in files (like grep)
Sourcepub fn find(
&self,
path: Option<&str>,
name_pattern: Option<&str>,
type_filter: Option<&str>,
) -> Result<String>
pub fn find( &self, path: Option<&str>, name_pattern: Option<&str>, type_filter: Option<&str>, ) -> Result<String>
Find files (like find)
Sourcepub fn cat(
&self,
path: &str,
start_line: Option<usize>,
end_line: Option<usize>,
) -> Result<String>
pub fn cat( &self, path: &str, start_line: Option<usize>, end_line: Option<usize>, ) -> Result<String>
Show file contents (like cat)
Sourcepub fn head(&self, path: &str, lines: usize) -> Result<String>
pub fn head(&self, path: &str, lines: usize) -> Result<String>
Show first/last lines of file (like head/tail)
pub fn tail(&self, path: &str, lines: usize) -> Result<String>
Trait Implementations§
Source§impl Clone for BashRunner
impl Clone for BashRunner
Source§fn clone(&self) -> BashRunner
fn clone(&self) -> BashRunner
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for BashRunner
impl RefUnwindSafe for BashRunner
impl Send for BashRunner
impl Sync for BashRunner
impl Unpin for BashRunner
impl UnwindSafe for BashRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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