mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
add command to checkout branch in all apps
This commit is contained in:
parent
f0bd58a17a
commit
5278f0d295
5 changed files with 191 additions and 0 deletions
13
src/args.rs
13
src/args.rs
|
|
@ -61,6 +61,9 @@ pub enum HazeArgs {
|
|||
filter: Option<String>,
|
||||
},
|
||||
Proxy,
|
||||
Checkout {
|
||||
branch: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
|
|
@ -212,6 +215,13 @@ impl HazeArgs {
|
|||
HazeCommand::Pin => Ok(HazeArgs::Pin { filter }),
|
||||
HazeCommand::Unpin => Ok(HazeArgs::Unpin { filter }),
|
||||
HazeCommand::Proxy => Ok(HazeArgs::Proxy),
|
||||
HazeCommand::Checkout => {
|
||||
let branch = args
|
||||
.next()
|
||||
.map(S::into)
|
||||
.ok_or_else(|| Report::msg("No branch provided"))?;
|
||||
Ok(HazeArgs::Checkout { branch })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -234,6 +244,7 @@ pub enum HazeCommand {
|
|||
Pin,
|
||||
Unpin,
|
||||
Proxy,
|
||||
Checkout,
|
||||
}
|
||||
|
||||
impl FromStr for HazeCommand {
|
||||
|
|
@ -258,6 +269,7 @@ impl FromStr for HazeCommand {
|
|||
"pin" => Ok(HazeCommand::Pin),
|
||||
"unpin" => Ok(HazeCommand::Unpin),
|
||||
"proxy" => Ok(HazeCommand::Proxy),
|
||||
"checkout" => Ok(HazeCommand::Checkout),
|
||||
_ => Err(Report::msg(format!("Unknown command: {}", s))),
|
||||
}
|
||||
}
|
||||
|
|
@ -282,6 +294,7 @@ impl HazeCommand {
|
|||
HazeCommand::Pin => true,
|
||||
HazeCommand::Unpin => true,
|
||||
HazeCommand::Proxy => false,
|
||||
HazeCommand::Checkout => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue