Skip to main content

AppEffect

Enum AppEffect 

Source
pub enum AppEffect {
Show 30 variants SetCurrentDir { path: PathBuf, }, WriteFile { path: PathBuf, content: String, }, ReadFile { path: PathBuf, }, DeleteFile { path: PathBuf, }, CreateDir { path: PathBuf, }, PathExists { path: PathBuf, }, SetReadOnly { path: PathBuf, readonly: bool, }, GitRequireRepo, GitGetRepoRoot, GitGetHeadOid, GitDiff, GitDiffFrom { start_oid: String, }, GitDiffFromStart, GitSnapshot, GitAddAll, GitCommit { message: String, user_name: Option<String>, user_email: Option<String>, }, GitSaveStartCommit, GitResetStartCommit, GitRebaseOnto { upstream_branch: String, }, GitGetConflictedFiles, GitContinueRebase, GitAbortRebase, GitGetDefaultBranch, GitIsMainBranch, GetEnvVar { name: String, }, SetEnvVar { name: String, value: String, }, LogInfo { message: String, }, LogSuccess { message: String, }, LogWarn { message: String, }, LogError { message: String, },
}
Expand description

App-level effects for CLI operations.

Each variant represents a side effect that can occur during CLI operations. Effects are data structures that describe what should happen without actually performing the operation.

§Categories

Effects are organized into logical categories:

  • Working Directory: Process working directory management
  • Filesystem: File and directory operations
  • Git: Version control operations
  • Environment: Environment variable access
  • Logging: User-facing output

Variants§

§

SetCurrentDir

Set the current working directory for the process.

Fields

§path: PathBuf

The path to set as the current directory.

§

WriteFile

Write content to a file, creating it if it doesn’t exist.

Fields

§path: PathBuf

Path to the file to write.

§content: String

Content to write to the file.

§

ReadFile

Read the contents of a file.

Fields

§path: PathBuf

Path to the file to read.

§

DeleteFile

Delete a file.

Fields

§path: PathBuf

Path to the file to delete.

§

CreateDir

Create a directory and all parent directories as needed.

Fields

§path: PathBuf

Path to the directory to create.

§

PathExists

Check if a path exists.

Fields

§path: PathBuf

Path to check for existence.

§

SetReadOnly

Set or clear the read-only flag on a file.

Fields

§path: PathBuf

Path to the file to modify.

§readonly: bool

Whether to make the file read-only.

§

GitRequireRepo

Verify that we’re in a git repository.

§

GitGetRepoRoot

Get the root directory of the git repository.

§

GitGetHeadOid

Get the OID (object identifier) of HEAD.

§

GitDiff

Get the diff of uncommitted changes.

§

GitDiffFrom

Get the diff from a specific commit OID to HEAD.

Fields

§start_oid: String

The starting commit OID.

§

GitDiffFromStart

Get the diff from the saved start commit to HEAD.

§

GitSnapshot

Create a snapshot of the current state (stash-like operation).

§

GitAddAll

Stage all changes for commit.

§

GitCommit

Create a commit with the given message.

Fields

§message: String

The commit message.

§user_name: Option<String>

Optional user name for the commit author.

§user_email: Option<String>

Optional user email for the commit author.

§

GitSaveStartCommit

Save the current HEAD as the start commit reference.

§

GitResetStartCommit

Reset the start commit reference to the merge-base.

§

GitRebaseOnto

Rebase the current branch onto an upstream branch.

Fields

§upstream_branch: String

The upstream branch to rebase onto.

§

GitGetConflictedFiles

Get the list of files with merge conflicts.

§

GitContinueRebase

Continue an in-progress rebase after conflicts are resolved.

§

GitAbortRebase

Abort an in-progress rebase.

§

GitGetDefaultBranch

Get the default branch name (main or master).

§

GitIsMainBranch

Check if the current branch is main or master.

§

GetEnvVar

Get the value of an environment variable.

Fields

§name: String

Name of the environment variable.

§

SetEnvVar

Set an environment variable.

Fields

§name: String

Name of the environment variable.

§value: String

Value to set.

§

LogInfo

Log an informational message.

Fields

§message: String

The message to log.

§

LogSuccess

Log a success message.

Fields

§message: String

The message to log.

§

LogWarn

Log a warning message.

Fields

§message: String

The message to log.

§

LogError

Log an error message.

Fields

§message: String

The message to log.

Trait Implementations§

Source§

impl Clone for AppEffect

Source§

fn clone(&self) -> AppEffect

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AppEffect

Source§

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

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

impl<'de> Deserialize<'de> for AppEffect

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for AppEffect

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AppEffect

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AppEffect

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> 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, 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> Same for T

Source§

type Output = T

Should always be Self
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 = 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,