实现:status命令

TODO:add 不存在的文件报错
This commit is contained in:
mrbeanc
2023-12-22 00:09:53 +08:00
parent f9e7ef493a
commit 5f1d115658
6 changed files with 128 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ use mit::commands::commit::commit;
use mit::commands::init::init;
use mit::commands::log::log;
use mit::commands::remove::remove;
use mit::commands::status::status;
/// Rust实现的简易版本的Git用于学习Rust语言
#[derive(Parser)]
@@ -51,6 +52,8 @@ enum Command {
#[clap(long, action)]
allow_empty: bool,
},
/// 查看当前状态
Status,
/// log 现实提交历史
Log {
#[clap(short = 'A', long)]
@@ -75,6 +78,9 @@ pub fn handle_command() {
Command::Commit { message, allow_empty } => {
commit(message, allow_empty);
}
Command::Status => {
status();
}
Command::Log { all, number } => {
log(all, number);
}