Skip to content

Commit

Permalink
move 'mailmap' 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 0ed65da commit 5cf08ce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
24 changes: 11 additions & 13 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, odb, revision, tree};
use crate::plumbing::options::{commit, mailmap, odb, revision, tree};
use crate::{
plumbing::options::{free, repo, Args, Subcommands},
shared::pretty::prepare_and_run,
Expand Down Expand Up @@ -599,6 +599,16 @@ pub fn main() -> Result<()> {
move |_progress, out, err| core::repository::odb::info(repository()?.into(), format, out, err),
),
},
Subcommands::Mailmap { cmd } => match cmd {
mailmap::Subcommands::Entries => prepare_and_run(
"repository-mailmap-entries",
verbose,
progress,
progress_keep_open,
None,
move |_progress, out, err| core::repository::mailmap::entries(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 @@ -635,18 +645,6 @@ pub fn main() -> Result<()> {
},
),
},
repo::Subcommands::Mailmap { cmd } => match cmd {
repo::mailmap::Subcommands::Entries => prepare_and_run(
"repository-mailmap-entries",
verbose,
progress,
progress_keep_open,
None,
move |_progress, out, err| {
core::repository::mailmap::entries(repository()?.into(), format, out, err)
},
),
},
},
}?;
Ok(())
Expand Down
26 changes: 13 additions & 13 deletions src/plumbing/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,26 @@ pub enum Subcommands {
#[clap(subcommand)]
cmd: revision::Subcommands,
},
/// Interact with the mailmap.
Mailmap {
#[clap(subcommand)]
cmd: mailmap::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 mailmap {
#[derive(Debug, clap::Subcommand)]
pub enum Subcommands {
/// Print all entries in configured mailmaps, inform about errors as well.
Entries,
}
}

pub mod odb {
#[derive(Debug, clap::Subcommand)]
pub enum Subcommands {
Expand Down Expand Up @@ -579,11 +592,6 @@ pub mod repo {
#[derive(Debug, clap::Subcommand)]
#[clap(visible_alias = "repo")]
pub enum Subcommands {
/// Interact with the mailmap.
Mailmap {
#[clap(subcommand)]
cmd: mailmap::Subcommands,
},
/// Interact with the exclude files like .gitignore.
Exclude {
#[clap(subcommand)]
Expand Down Expand Up @@ -616,12 +624,4 @@ pub mod repo {
},
}
}

pub mod mailmap {
#[derive(Debug, clap::Subcommand)]
pub enum Subcommands {
/// Print all entries in configured mailmaps, inform about errors as well.
Entries,
}
}
}

0 comments on commit 5cf08ce

Please sign in to comment.