forked from mirrors/jj
cli: move cmd_git() dispatcher function next to GitCommand enum
This commit is contained in:
parent
e5a3d6a2ba
commit
567f0db734
1 changed files with 17 additions and 17 deletions
|
@ -55,6 +55,23 @@ pub enum GitCommand {
|
|||
Submodule(SubmoduleCommand),
|
||||
}
|
||||
|
||||
pub fn cmd_git(
|
||||
ui: &mut Ui,
|
||||
command: &CommandHelper,
|
||||
subcommand: &GitCommand,
|
||||
) -> Result<(), CommandError> {
|
||||
match subcommand {
|
||||
GitCommand::Clone(args) => cmd_git_clone(ui, command, args),
|
||||
GitCommand::Export(args) => cmd_git_export(ui, command, args),
|
||||
GitCommand::Fetch(args) => cmd_git_fetch(ui, command, args),
|
||||
GitCommand::Import(args) => cmd_git_import(ui, command, args),
|
||||
GitCommand::Init(args) => cmd_git_init(ui, command, args),
|
||||
GitCommand::Push(args) => cmd_git_push(ui, command, args),
|
||||
GitCommand::Remote(args) => cmd_git_remote(ui, command, args),
|
||||
GitCommand::Submodule(args) => cmd_git_submodule(ui, command, args),
|
||||
}
|
||||
}
|
||||
|
||||
fn map_git_error(err: git2::Error) -> CommandError {
|
||||
if err.class() == git2::ErrorClass::Ssh {
|
||||
let hint =
|
||||
|
@ -95,20 +112,3 @@ fn get_single_remote(git_repo: &git2::Repository) -> Result<Option<String>, Comm
|
|||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn cmd_git(
|
||||
ui: &mut Ui,
|
||||
command: &CommandHelper,
|
||||
subcommand: &GitCommand,
|
||||
) -> Result<(), CommandError> {
|
||||
match subcommand {
|
||||
GitCommand::Clone(args) => cmd_git_clone(ui, command, args),
|
||||
GitCommand::Export(args) => cmd_git_export(ui, command, args),
|
||||
GitCommand::Fetch(args) => cmd_git_fetch(ui, command, args),
|
||||
GitCommand::Import(args) => cmd_git_import(ui, command, args),
|
||||
GitCommand::Init(args) => cmd_git_init(ui, command, args),
|
||||
GitCommand::Push(args) => cmd_git_push(ui, command, args),
|
||||
GitCommand::Remote(args) => cmd_git_remote(ui, command, args),
|
||||
GitCommand::Submodule(args) => cmd_git_submodule(ui, command, args),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue