add checkouts
This commit is contained in:
parent
8a7833b57e
commit
5ad496cfa1
15
src/main.rs
15
src/main.rs
@ -6,10 +6,23 @@ fn main() -> eyre::Result<()> {
|
||||
let args = args.collect::<Vec<String>>();
|
||||
let args = args.iter().map(|s| s.as_str()).collect::<Vec<&str>>();
|
||||
|
||||
let cmd = clap::Command::new("git-toolkit").allow_external_subcommands(true);
|
||||
let cmd = clap::Command::new("git-toolkit")
|
||||
.allow_external_subcommands(true)
|
||||
.subcommand(clap::Command::new("cb").arg(clap::Arg::new("branch").required(true)))
|
||||
.subcommand(clap::Command::new("c").arg(clap::Arg::new("branch").required(true)));
|
||||
|
||||
let matches = cmd.get_matches_from(args.clone().as_slice());
|
||||
match matches.subcommand() {
|
||||
Some(("cb", args)) => {
|
||||
let branch = args.get_one::<String>("branch").unwrap();
|
||||
|
||||
prepend_git_shell(&["checkout", "-b", branch])?;
|
||||
}
|
||||
Some(("c", args)) => {
|
||||
let branch = args.get_one::<String>("branch").unwrap();
|
||||
|
||||
prepend_git_shell(&["checkout", branch])?;
|
||||
}
|
||||
Some((_, args)) => {
|
||||
let raw = args
|
||||
.get_many::<std::ffi::OsString>("")
|
||||
|
Loading…
Reference in New Issue
Block a user