fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs - Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions - Updated all modules (analyzer, generator, prompt) to import from super::git - Fixed module organization to resolve compilation errors
This commit is contained in:
21
src/cli.rs
21
src/cli.rs
@@ -15,7 +15,7 @@ pub enum CommitTypeCli {
|
|||||||
Perf,
|
Perf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Debug, Parser)]
|
||||||
#[command(name = "auto-commit")]
|
#[command(name = "auto-commit")]
|
||||||
#[command(author, version, about, long_about = None)]
|
#[command(author, version, about, long_about = None)]
|
||||||
pub struct Args {
|
pub struct Args {
|
||||||
@@ -35,6 +35,25 @@ pub struct Args {
|
|||||||
pub verbose: bool,
|
pub verbose: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::str::FromStr for CommitTypeCli {
|
||||||
|
type Err = String;
|
||||||
|
|
||||||
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
|
match s.to_lowercase().as_str() {
|
||||||
|
"feat" | "feature" => Ok(CommitTypeCli::Feat),
|
||||||
|
"fix" | "bug" => Ok(CommitTypeCli::Fix),
|
||||||
|
"docs" | "documentation" => Ok(CommitTypeCli::Docs),
|
||||||
|
"style" => Ok(CommitTypeCli::Style),
|
||||||
|
"refactor" => Ok(CommitTypeCli::Refactor),
|
||||||
|
"test" | "tests" => Ok(CommitTypeCli::Test),
|
||||||
|
"chore" => Ok(CommitTypeCli::Chore),
|
||||||
|
"build" | "ci" => Ok(CommitTypeCli::Build),
|
||||||
|
"perf" | "performance" => Ok(CommitTypeCli::Perf),
|
||||||
|
_ => Err(format!("Unknown commit type: {}", s)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<CommitTypeCli> for CommitType {
|
impl From<CommitTypeCli> for CommitType {
|
||||||
fn from(cli_type: CommitTypeCli) -> Self {
|
fn from(cli_type: CommitTypeCli) -> Self {
|
||||||
match cli_type {
|
match cli_type {
|
||||||
|
|||||||
Reference in New Issue
Block a user