mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
use extra app directories for git operations
This commit is contained in:
parent
1a6dd90410
commit
e9cb4f08e3
3 changed files with 42 additions and 21 deletions
17
src/args.rs
17
src/args.rs
|
|
@ -124,9 +124,12 @@ pub enum GitOperation {
|
|||
///
|
||||
/// "main" and "master" can be used interchangeably.
|
||||
#[strum(props(
|
||||
Args = "[branch] branch to checkout, defaults to the branch matching the current server version"
|
||||
Args = "[branch] branch to checkout, defaults to the branch matching the current server version [-v] verbose"
|
||||
))]
|
||||
Checkout { branch: Option<String> },
|
||||
Checkout {
|
||||
branch: Option<String>,
|
||||
verbose: bool,
|
||||
},
|
||||
}
|
||||
|
||||
impl SubCommand for GitOperation {
|
||||
|
|
@ -320,18 +323,24 @@ impl HazeArgs {
|
|||
HazeCommand::Checkout => {
|
||||
let branch = args.next().map(S::into);
|
||||
Ok(HazeArgs::Git {
|
||||
operation: GitOperation::Checkout { branch },
|
||||
operation: GitOperation::Checkout {
|
||||
branch,
|
||||
verbose: false,
|
||||
},
|
||||
})
|
||||
}
|
||||
HazeCommand::Git => {
|
||||
let mut args = args.peekable();
|
||||
let operation = args
|
||||
.next()
|
||||
.ok_or_else(|| Report::msg("No git operation provided"))?;
|
||||
match operation.as_ref() {
|
||||
"checkout" => {
|
||||
let verbose = args.next_if(|arg| arg.as_ref() == "-v").is_some();
|
||||
let branch = args.next().map(S::into);
|
||||
let verbose = verbose | args.next_if(|arg| arg.as_ref() == "-v").is_some();
|
||||
Ok(HazeArgs::Git {
|
||||
operation: GitOperation::Checkout { branch },
|
||||
operation: GitOperation::Checkout { branch, verbose },
|
||||
})
|
||||
}
|
||||
"pull" => Ok(HazeArgs::Git {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue