Skip to content

Commit c9c78e8

Browse files
committed
move 'revision' one level up (#331)
1 parent 8967fcd commit c9c78e8

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

Diff for: src/plumbing/main.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use git_repository::bstr::io::BufReadExt;
1313
use gitoxide_core as core;
1414
use gitoxide_core::pack::verify;
1515

16+
use crate::plumbing::options::revision;
1617
use crate::{
1718
plumbing::options::{free, repo, Args, Subcommands},
1819
shared::pretty::prepare_and_run,
@@ -473,17 +474,17 @@ pub fn main() -> Result<()> {
473474
},
474475
},
475476
},
477+
Subcommands::Revision { cmd } => match cmd {
478+
revision::Subcommands::Explain { spec } => prepare_and_run(
479+
"repository-commit-describe",
480+
verbose,
481+
progress,
482+
progress_keep_open,
483+
None,
484+
move |_progress, out, _err| core::repository::revision::explain(repository()?.into(), spec, out),
485+
),
486+
},
476487
Subcommands::Repository(repo::Platform { cmd }) => match cmd {
477-
repo::Subcommands::Revision { cmd } => match cmd {
478-
repo::revision::Subcommands::Explain { spec } => prepare_and_run(
479-
"repository-commit-describe",
480-
verbose,
481-
progress,
482-
progress_keep_open,
483-
None,
484-
move |_progress, out, _err| core::repository::revision::explain(repository()?.into(), spec, out),
485-
),
486-
},
487488
repo::Subcommands::Commit { cmd } => match cmd {
488489
repo::commit::Subcommands::Describe {
489490
annotated_tags,

Diff for: src/plumbing/options.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,27 @@ pub struct Args {
5151

5252
#[derive(Debug, clap::Subcommand)]
5353
pub enum Subcommands {
54+
/// Query and obtain information about revisions.
55+
Revision {
56+
#[clap(subcommand)]
57+
cmd: revision::Subcommands,
58+
},
5459
/// Subcommands for interacting with entire git repositories
5560
Repository(repo::Platform),
5661
/// Subcommands that need no git repository to run.
5762
#[clap(subcommand)]
5863
Free(free::Subcommands),
5964
}
6065

66+
pub mod revision {
67+
#[derive(Debug, clap::Subcommand)]
68+
#[clap(visible_alias = "rev")]
69+
pub enum Subcommands {
70+
/// Provide the revision specification like `@~1` to explain.
71+
Explain { spec: std::ffi::OsString },
72+
}
73+
}
74+
6175
///
6276
pub mod free {
6377
#[derive(Debug, clap::Subcommand)]
@@ -499,20 +513,6 @@ pub mod repo {
499513
#[clap(subcommand)]
500514
cmd: exclude::Subcommands,
501515
},
502-
/// Query and obtain information about revisions.
503-
Revision {
504-
#[clap(subcommand)]
505-
cmd: revision::Subcommands,
506-
},
507-
}
508-
509-
pub mod revision {
510-
#[derive(Debug, clap::Subcommand)]
511-
#[clap(visible_alias = "rev")]
512-
pub enum Subcommands {
513-
/// Provide the revision specification like `@~1` to explain.
514-
Explain { spec: std::ffi::OsString },
515-
}
516516
}
517517

518518
pub mod exclude {

0 commit comments

Comments
 (0)