-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented sub_command and list option
- Loading branch information
1 parent
52a8885
commit c130780
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use clap::Parser; | ||
|
||
fn main() { | ||
let args: Args = Args::parse(); | ||
let is_listed: bool = args.list; | ||
|
||
match args.sub_command.as_str() { | ||
"set-income" => { | ||
println!("set-income is running...") | ||
} | ||
"get-balance" => { | ||
println!("{}", is_listed); | ||
println!("get-balance is running...") | ||
} | ||
"set-expense" => { | ||
println!("set-expense is running..."); | ||
} | ||
_ => { | ||
eprintln!("Unknown command: {}", &args.sub_command); | ||
} | ||
} | ||
|
||
} | ||
|
||
#[derive(Debug, Parser)] | ||
#[command(author, version, about)] | ||
pub struct Args { | ||
#[arg(help = "What you want to do")] | ||
pub sub_command: String, | ||
|
||
#[arg(long, help = "If you want kakei to show as list, use --list")] | ||
pub list: bool, | ||
} |
This file was deleted.
Oops, something went wrong.