add checkouts

This commit is contained in:
Kasper Juul Hermansen 2023-01-24 09:49:35 +01:00
parent 8a7833b57e
commit 5ad496cfa1
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912

View File

@ -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>("")