1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 17:14:08 +02:00

make haze git checkout pick the correct branch by default

This commit is contained in:
Robin Appelman 2026-02-13 21:22:21 +01:00
commit b2a7b22676
4 changed files with 78 additions and 11 deletions

View file

@ -123,8 +123,10 @@ pub enum GitOperation {
/// Checkout a branch in all apps
///
/// "main" and "master" can be used interchangeably.
#[strum(props(Args = "[branch] branch to checkout"))]
Checkout { branch: String },
#[strum(props(
Args = "[branch] branch to checkout, defaults to the branch matching the current server version"
))]
Checkout { branch: Option<String> },
}
impl SubCommand for GitOperation {
@ -316,10 +318,7 @@ impl HazeArgs {
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"))?;
let branch = args.next().map(S::into);
Ok(HazeArgs::Git {
operation: GitOperation::Checkout { branch },
})
@ -330,10 +329,7 @@ impl HazeArgs {
.ok_or_else(|| Report::msg("No git operation provided"))?;
match operation.as_ref() {
"checkout" => {
let branch = args
.next()
.map(S::into)
.ok_or_else(|| Report::msg("No branch provided"))?;
let branch = args.next().map(S::into);
Ok(HazeArgs::Git {
operation: GitOperation::Checkout { branch },
})