From 0ed65da9b66d4cc3c85d3b70fa4bc383c7a0d1a3 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 22 Jul 2022 10:46:01 +0800 Subject: [PATCH] move 'odb' up one level (#331) --- src/plumbing/main.rs | 38 +++++++++++++++++++------------------- src/plumbing/options.rs | 30 +++++++++++++++--------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/plumbing/main.rs b/src/plumbing/main.rs index 807a8d9f0c9..9641fededec 100644 --- a/src/plumbing/main.rs +++ b/src/plumbing/main.rs @@ -13,7 +13,7 @@ use git_repository::bstr::io::BufReadExt; use gitoxide_core as core; use gitoxide_core::pack::verify; -use crate::plumbing::options::{commit, revision, tree}; +use crate::plumbing::options::{commit, odb, revision, tree}; use crate::{ plumbing::options::{free, repo, Args, Subcommands}, shared::pretty::prepare_and_run, @@ -581,6 +581,24 @@ pub fn main() -> Result<()> { }, ), }, + Subcommands::Odb { cmd } => match cmd { + odb::Subcommands::Entries => prepare_and_run( + "repository-odb-entries", + verbose, + progress, + progress_keep_open, + None, + move |_progress, out, _err| core::repository::odb::entries(repository()?.into(), format, out), + ), + odb::Subcommands::Info => prepare_and_run( + "repository-odb-info", + verbose, + progress, + progress_keep_open, + None, + move |_progress, out, err| core::repository::odb::info(repository()?.into(), format, out, err), + ), + }, Subcommands::Repository(repo::Platform { cmd }) => match cmd { repo::Subcommands::Exclude { cmd } => match cmd { repo::exclude::Subcommands::Query { @@ -629,24 +647,6 @@ pub fn main() -> Result<()> { }, ), }, - repo::Subcommands::Odb { cmd } => match cmd { - repo::odb::Subcommands::Entries => prepare_and_run( - "repository-odb-entries", - verbose, - progress, - progress_keep_open, - None, - move |_progress, out, _err| core::repository::odb::entries(repository()?.into(), format, out), - ), - repo::odb::Subcommands::Info => prepare_and_run( - "repository-odb-info", - verbose, - progress, - progress_keep_open, - None, - move |_progress, out, err| core::repository::odb::info(repository()?.into(), format, out, err), - ), - }, }, }?; Ok(()) diff --git a/src/plumbing/options.rs b/src/plumbing/options.rs index 9c4cd5409fb..e4b8d9cb0c3 100644 --- a/src/plumbing/options.rs +++ b/src/plumbing/options.rs @@ -51,6 +51,11 @@ pub struct Args { #[derive(Debug, clap::Subcommand)] pub enum Subcommands { + /// Interact with the object database. + Odb { + #[clap(subcommand)] + cmd: odb::Subcommands, + }, /// Interact with tree objects. Tree { #[clap(subcommand)] @@ -78,6 +83,16 @@ pub enum Subcommands { Free(free::Subcommands), } +pub mod odb { + #[derive(Debug, clap::Subcommand)] + pub enum Subcommands { + /// Print all object names. + Entries, + /// Provide general information about the object database. + Info, + } +} + pub mod tree { #[derive(Debug, clap::Subcommand)] pub enum Subcommands { @@ -564,11 +579,6 @@ pub mod repo { #[derive(Debug, clap::Subcommand)] #[clap(visible_alias = "repo")] pub enum Subcommands { - /// Interact with the object database. - Odb { - #[clap(subcommand)] - cmd: odb::Subcommands, - }, /// Interact with the mailmap. Mailmap { #[clap(subcommand)] @@ -614,14 +624,4 @@ pub mod repo { Entries, } } - - pub mod odb { - #[derive(Debug, clap::Subcommand)] - pub enum Subcommands { - /// Print all object names. - Entries, - /// Provide general information about the object database. - Info, - } - } }