From e1b21b66af2a044acf225611eeb61c695e9a4147 Mon Sep 17 00:00:00 2001 From: mrbeanc Date: Sun, 17 Dec 2023 12:19:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eadd=20.=20&=20add=20-a?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cli.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 91f6a2f..50bc653 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -17,6 +17,9 @@ enum Command { Add { /// 要添加的文件 files: Vec, + + #[clap(short, long)] + all: bool, }, /// 删除文件 Rm { @@ -41,8 +44,12 @@ pub fn handle_command() { Command::Init => { println!("init"); } - Command::Add { files } => { - println!("add: {:?}", files); + Command::Add { files , all } => { + if files.contains(&".".to_string()) || all { + println!("add all files"); + } else { + println!("add: {:?}, all:{:?}", files, all); + } } Command::Rm { files, cached } => { println!("rm: {:?}, cached= {}", files, cached);