ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: move cmd_operation() dispatcher fn next to type definition

This commit is contained in:
Yuya Nishihara 2024-06-22 10:03:46 +09:00
parent 15e0d62380
commit b72f2827d0

View file

@ -39,6 +39,19 @@ pub enum OperationCommand {
Restore(OperationRestoreArgs),
}
pub fn cmd_operation(
ui: &mut Ui,
command: &CommandHelper,
subcommand: &OperationCommand,
) -> Result<(), CommandError> {
match subcommand {
OperationCommand::Abandon(args) => cmd_op_abandon(ui, command, args),
OperationCommand::Log(args) => cmd_op_log(ui, command, args),
OperationCommand::Restore(args) => cmd_op_restore(ui, command, args),
OperationCommand::Undo(args) => cmd_op_undo(ui, command, args),
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
pub enum UndoWhatToRestore {
/// The jj repo state and local branches
@ -77,16 +90,3 @@ fn view_with_desired_portions_restored(
wc_commit_ids: repo_source.wc_commit_ids.clone(),
}
}
pub fn cmd_operation(
ui: &mut Ui,
command: &CommandHelper,
subcommand: &OperationCommand,
) -> Result<(), CommandError> {
match subcommand {
OperationCommand::Abandon(args) => cmd_op_abandon(ui, command, args),
OperationCommand::Log(args) => cmd_op_log(ui, command, args),
OperationCommand::Restore(args) => cmd_op_restore(ui, command, args),
OperationCommand::Undo(args) => cmd_op_undo(ui, command, args),
}
}