Struct CommitOptions

Source
pub struct CommitOptions { /* private fields */ }
Expand description

git commit command.

use mhgit::{CommandOptions, Repository};
use mhgit::commands::CommitOptions;

let repo = Repository::new();
CommitOptions::new()
    .amend(true)
    .file("foo.txt")
    .message("Initial commit")
    .run(&repo)?;

Implementations§

Source§

impl CommitOptions

Source

pub fn new() -> CommitOptions

Create a new set of git commit options.

Source

pub fn all(&mut self, val: bool) -> &mut CommitOptions

Add –all options.

Source

pub fn allow_empty(&mut self, val: bool) -> &mut CommitOptions

Add –allow-empty option.

Source

pub fn amend(&mut self, val: bool) -> &mut CommitOptions

Add –amend option.

Source

pub fn file(&mut self, file: impl ToString) -> &mut CommitOptions

Add file to commit command.

Source

pub fn files<I, S>(&mut self, files: I) -> &mut CommitOptions
where I: IntoIterator<Item = S>, S: ToString,

Add multiple files to commit command.

Source

pub fn message(&mut self, msg: &str) -> &mut CommitOptions

Set commit message.

Trait Implementations§

Source§

impl CommandOptions for CommitOptions

Source§

type Output = ()

Source§

fn git_args(&self) -> Vec<&str>

Return a vector of the arguments passed to git. Read more
Source§

fn parse_output(&self, out: &str) -> Result<Self::Output, Error>

Parse the captured stdout into an appropriate rust type.
Source§

fn run(&self, repo: &Repository) -> Result<Self::Output, Error>

Run the command in the given git repository. Calling git and parsing and return the output of the command, if any. Read more
Source§

impl Debug for CommitOptions

Source§

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

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

impl Default for CommitOptions

Source§

fn default() -> CommitOptions

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

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<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> 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<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.