cli: bench: place command dispatcher function closer to enum definition

This commit is contained in:
Yuya Nishihara 2024-11-04 10:43:49 +09:00
parent 0ae282180a
commit 541376b944

View file

@ -50,6 +50,19 @@ pub enum BenchCommand {
Revset(BenchRevsetArgs),
}
pub(crate) fn cmd_bench(
ui: &mut Ui,
command: &CommandHelper,
subcommand: &BenchCommand,
) -> Result<(), CommandError> {
match subcommand {
BenchCommand::CommonAncestors(args) => cmd_bench_common_ancestors(ui, command, args),
BenchCommand::IsAncestor(args) => cmd_bench_is_ancestor(ui, command, args),
BenchCommand::ResolvePrefix(args) => cmd_bench_resolve_prefix(ui, command, args),
BenchCommand::Revset(args) => cmd_bench_revset(ui, command, args),
}
}
#[derive(clap::Args, Clone, Debug)]
struct CriterionArgs {
/// Name of baseline to save results
@ -94,16 +107,3 @@ where
});
Ok(())
}
pub(crate) fn cmd_bench(
ui: &mut Ui,
command: &CommandHelper,
subcommand: &BenchCommand,
) -> Result<(), CommandError> {
match subcommand {
BenchCommand::CommonAncestors(args) => cmd_bench_common_ancestors(ui, command, args),
BenchCommand::IsAncestor(args) => cmd_bench_is_ancestor(ui, command, args),
BenchCommand::ResolvePrefix(args) => cmd_bench_resolve_prefix(ui, command, args),
BenchCommand::Revset(args) => cmd_bench_revset(ui, command, args),
}
}