Skip to content

Commit

Permalink
move 'odb' up one level (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 22, 2022
1 parent 38a8350 commit 0ed65da
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
38 changes: 19 additions & 19 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(())
Expand Down
30 changes: 15 additions & 15 deletions src/plumbing/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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,
}
}
}

0 comments on commit 0ed65da

Please sign in to comment.