mirror of
https://github.com/MrBeanCpp/MIT.git
synced 2026-03-23 21:41:00 +08:00
git log实现与测试
This commit is contained in:
12
src/cli.rs
12
src/cli.rs
@@ -2,6 +2,7 @@ use clap::{Parser, Subcommand};
|
||||
use mit::commands::add::add;
|
||||
use mit::commands::commit::commit;
|
||||
use mit::commands::init::init;
|
||||
use mit::commands::log::log;
|
||||
use mit::commands::remove::remove;
|
||||
|
||||
/// Rust实现的简易版本的Git,用于学习Rust语言
|
||||
@@ -50,6 +51,14 @@ enum Command {
|
||||
#[clap(long, action)]
|
||||
allow_empty: bool,
|
||||
},
|
||||
/// log 现实提交历史
|
||||
Log {
|
||||
#[clap(short = 'A', long)]
|
||||
all: bool,
|
||||
|
||||
#[clap(short, long)]
|
||||
number: Option<usize>,
|
||||
},
|
||||
}
|
||||
pub fn handle_command() {
|
||||
let cli = Cli::parse();
|
||||
@@ -66,5 +75,8 @@ pub fn handle_command() {
|
||||
Command::Commit { message, allow_empty } => {
|
||||
commit(message, allow_empty);
|
||||
}
|
||||
Command::Log { all, number } => {
|
||||
log(all, number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user