Update libs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "command-with-spinner"
|
||||
version = "0.1.0"
|
||||
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
license-file.workspace = true
|
||||
@@ -9,5 +10,5 @@ repository.workspace = true
|
||||
[dependencies]
|
||||
anyhow = "1.0.98"
|
||||
colored = "3.0.0"
|
||||
git = { version = "0.1.0", path = "../git" }
|
||||
indicatif = "0.17.11"
|
||||
thiserror = "2.0"
|
||||
|
12
command-with-spinner/src/error.rs
Normal file
12
command-with-spinner/src/error.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
/// Git operations error type
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum CommandError {
|
||||
#[error("Command failed with exit code: {0}")]
|
||||
Failed(i32),
|
||||
|
||||
#[error("Command failed without exit code")]
|
||||
FailedNoCode,
|
||||
|
||||
#[error("Failed to execute command: {0}")]
|
||||
ExecutionError(#[from] std::io::Error),
|
||||
}
|
@@ -4,7 +4,8 @@ use anyhow::{Context, Result};
|
||||
use colored::*;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
|
||||
use git::error::GitError;
|
||||
mod error;
|
||||
use error::CommandError;
|
||||
|
||||
/// Runs a git command with a progress spinner
|
||||
pub fn run_command(command: &mut Command, message: &str) -> Result<()> {
|
||||
@@ -34,8 +35,8 @@ pub fn run_command(command: &mut Command, message: &str) -> Result<()> {
|
||||
|
||||
let code = status.code();
|
||||
match code {
|
||||
Some(code) => Err(GitError::Failed(code).into()),
|
||||
None => Err(GitError::FailedNoCode.into()),
|
||||
Some(code) => Err(CommandError::Failed(code).into()),
|
||||
None => Err(CommandError::FailedNoCode.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user