Skip to content

Commit

Permalink
move 'revision' one level up (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 22, 2022
1 parent 8967fcd commit c9c78e8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
21 changes: 11 additions & 10 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use git_repository::bstr::io::BufReadExt;
use gitoxide_core as core;
use gitoxide_core::pack::verify;

use crate::plumbing::options::revision;
use crate::{
plumbing::options::{free, repo, Args, Subcommands},
shared::pretty::prepare_and_run,
Expand Down Expand Up @@ -473,17 +474,17 @@ pub fn main() -> Result<()> {
},
},
},
Subcommands::Revision { cmd } => match cmd {
revision::Subcommands::Explain { spec } => prepare_and_run(
"repository-commit-describe",
verbose,
progress,
progress_keep_open,
None,
move |_progress, out, _err| core::repository::revision::explain(repository()?.into(), spec, out),
),
},
Subcommands::Repository(repo::Platform { cmd }) => match cmd {
repo::Subcommands::Revision { cmd } => match cmd {
repo::revision::Subcommands::Explain { spec } => prepare_and_run(
"repository-commit-describe",
verbose,
progress,
progress_keep_open,
None,
move |_progress, out, _err| core::repository::revision::explain(repository()?.into(), spec, out),
),
},
repo::Subcommands::Commit { cmd } => match cmd {
repo::commit::Subcommands::Describe {
annotated_tags,
Expand Down
28 changes: 14 additions & 14 deletions src/plumbing/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,27 @@ pub struct Args {

#[derive(Debug, clap::Subcommand)]
pub enum Subcommands {
/// Query and obtain information about revisions.
Revision {
#[clap(subcommand)]
cmd: revision::Subcommands,
},
/// Subcommands for interacting with entire git repositories
Repository(repo::Platform),
/// Subcommands that need no git repository to run.
#[clap(subcommand)]
Free(free::Subcommands),
}

pub mod revision {
#[derive(Debug, clap::Subcommand)]
#[clap(visible_alias = "rev")]
pub enum Subcommands {
/// Provide the revision specification like `@~1` to explain.
Explain { spec: std::ffi::OsString },
}
}

///
pub mod free {
#[derive(Debug, clap::Subcommand)]
Expand Down Expand Up @@ -499,20 +513,6 @@ pub mod repo {
#[clap(subcommand)]
cmd: exclude::Subcommands,
},
/// Query and obtain information about revisions.
Revision {
#[clap(subcommand)]
cmd: revision::Subcommands,
},
}

pub mod revision {
#[derive(Debug, clap::Subcommand)]
#[clap(visible_alias = "rev")]
pub enum Subcommands {
/// Provide the revision specification like `@~1` to explain.
Explain { spec: std::ffi::OsString },
}
}

pub mod exclude {
Expand Down

0 comments on commit c9c78e8

Please sign in to comment.