Skip to main content

GitCommand

Trait GitCommand 

Source
pub trait GitCommand {
    type Output;

Show 13 methods // Required methods fn get_executor(&self) -> &CommandExecutor; fn get_executor_mut(&mut self) -> &mut CommandExecutor; fn build_command_args(&self) -> Vec<String>; fn execute<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn execute_raw<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self { ... } fn args<I, S>(&mut self, args: I) -> &mut Self where I: IntoIterator<Item = S>, S: AsRef<OsStr> { ... } fn flag(&mut self, flag: &str) -> &mut Self { ... } fn option(&mut self, key: &str, value: &str) -> &mut Self { ... } fn current_dir<P: Into<PathBuf>>(&mut self, dir: P) -> &mut Self { ... } fn env<K: Into<OsString>, V: Into<OsString>>( &mut self, key: K, value: V, ) -> &mut Self { ... } fn with_timeout(&mut self, timeout: Duration) -> &mut Self { ... } fn with_timeout_secs(&mut self, seconds: u64) -> &mut Self { ... }
}
Expand description

Trait implemented by every git subcommand wrapper.

Required Associated Types§

Source

type Output

The typed output produced by this command.

Required Methods§

Source

fn get_executor(&self) -> &CommandExecutor

Borrow the shared executor.

Source

fn get_executor_mut(&mut self) -> &mut CommandExecutor

Mutably borrow the shared executor.

Source

fn build_command_args(&self) -> Vec<String>

Build the full argument vector (subcommand + flags + positionals) excluding the leading git program.

Source

fn execute<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run the command and decode its output into Self::Output.

Provided Methods§

Source

fn execute_raw<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Spawn git with the given arguments and return the raw output.

Command implementations call this from execute() and then decode stdout into their typed output.

Source

fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self

Append a single raw argument.

Source

fn args<I, S>(&mut self, args: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<OsStr>,

Append several raw arguments.

Source

fn flag(&mut self, flag: &str) -> &mut Self

Append a --flag (or -f if a single character).

Source

fn option(&mut self, key: &str, value: &str) -> &mut Self

Append a --key value pair.

Source

fn current_dir<P: Into<PathBuf>>(&mut self, dir: P) -> &mut Self

Run git in the given working directory.

Source

fn env<K: Into<OsString>, V: Into<OsString>>( &mut self, key: K, value: V, ) -> &mut Self

Set an environment variable for this invocation.

Source

fn with_timeout(&mut self, timeout: Duration) -> &mut Self

Cap execution time. On expiry the process is killed and Error::Timeout is returned.

Source

fn with_timeout_secs(&mut self, seconds: u64) -> &mut Self

Convenience: set timeout in whole seconds.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl GitCommand for AddCommand

Source§

impl GitCommand for BisectCommand

Source§

impl GitCommand for BranchCommand

Source§

impl GitCommand for CatFileCommand

Source§

impl GitCommand for CheckoutCommand

Source§

impl GitCommand for CherryPickCommand

Source§

impl GitCommand for CloneCommand

Source§

impl GitCommand for CommitCommand

Source§

impl GitCommand for ConfigCommand

Source§

impl GitCommand for DescribeCommand

Source§

impl GitCommand for DiffCommand

Source§

impl GitCommand for FetchCommand

Source§

impl GitCommand for ForEachRefCommand

Source§

impl GitCommand for GrepCommand

Source§

impl GitCommand for HashObjectCommand

Source§

impl GitCommand for InitCommand

Source§

impl GitCommand for LogCommand

Source§

impl GitCommand for LsFilesCommand

Source§

impl GitCommand for LsTreeCommand

Source§

impl GitCommand for MergeCommand

Source§

impl GitCommand for MvCommand

Source§

impl GitCommand for PullCommand

Source§

impl GitCommand for PushCommand

Source§

impl GitCommand for RebaseCommand

Source§

impl GitCommand for ReflogCommand

Source§

impl GitCommand for RemoteCommand

Source§

impl GitCommand for ResetCommand

Source§

impl GitCommand for RestoreCommand

Source§

impl GitCommand for RevParseCommand

Source§

impl GitCommand for RmCommand

Source§

impl GitCommand for ShowCommand

Source§

impl GitCommand for ShowRefCommand

Source§

impl GitCommand for StashCommand

Source§

impl GitCommand for StatusCommand

Source§

impl GitCommand for SubmoduleCommand

Source§

impl GitCommand for SwitchCommand

Source§

impl GitCommand for SymbolicRefCommand

Source§

impl GitCommand for TagCommand

Source§

impl GitCommand for UpdateRefCommand

Source§

impl GitCommand for WorktreeCommand