git log实现与测试

This commit is contained in:
HouXiaoxuan
2023-12-21 23:01:05 +08:00
parent a8707149a9
commit f9e7ef493a
4 changed files with 112 additions and 2 deletions

View File

@@ -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);
}
}
}