Skip to content

Commit

Permalink
upgrade to clap 3 beta 5 (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Oct 18, 2021
1 parent e20f498 commit 2ddc4ed
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 53 deletions.
47 changes: 25 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo-smart-release/src/cli/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod options;
use clap::Clap;
use clap::Parser;
use options::{Args, SubCommands};

use cargo_smart_release::command;
Expand Down
9 changes: 3 additions & 6 deletions cargo-smart-release/src/cli/options.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use clap::{AppSettings, Clap};
use clap::AppSettings;

#[derive(Clap)]
#[derive(clap::Parser)]
#[clap(setting = AppSettings::SubcommandRequired)]
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableHelpSubcommand)]
#[clap(setting = AppSettings::DisableVersionFlag)]
#[clap(bin_name = "cargo")]
Expand All @@ -14,9 +13,8 @@ pub struct Args {
pub subcommands: SubCommands,
}

#[derive(Clap)]
#[derive(clap::Parser)]
pub enum SubCommands {
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(name = "smart-release", version = clap::crate_version!())]
/// Release workspace crates fearlessly.
///
Expand Down Expand Up @@ -162,7 +160,6 @@ pub enum SubCommands {
#[clap(long, help_heading = Some("EXPERT"))]
ignore_instability: bool,
},
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(name = "changelog", version = clap::crate_version!())]
/// Generate changelogs from commit histories, non-destructively.
///
Expand Down
2 changes: 1 addition & 1 deletion src/plumbing/pretty/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
};

use anyhow::Result;
use clap::Clap;
use clap::Parser;
use gitoxide_core as core;
use gitoxide_core::pack::verify;

Expand Down
14 changes: 3 additions & 11 deletions src/plumbing/pretty/options.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use std::{ffi::OsString, path::PathBuf};

use clap::{AppSettings, Clap};
use clap::AppSettings;
use gitoxide_core as core;

#[derive(Debug, Clap)]
#[derive(Debug, clap::Parser)]
#[clap(name = "gix-plumbing", about = "The git underworld", version = clap::crate_version!())]
#[clap(setting = AppSettings::SubcommandRequired)]
#[clap(setting = AppSettings::ColoredHelp)]
pub struct Args {
#[clap(long, short = 't')]
/// The amount of threads to use for some operations.
Expand Down Expand Up @@ -41,9 +40,8 @@ pub struct Args {
pub cmd: Subcommands,
}

#[derive(Debug, Clap)]
#[derive(Debug, clap::Parser)]
pub enum Subcommands {
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableVersionFlag)]
PackCreate {
#[clap(long, short = 'r')]
Expand Down Expand Up @@ -103,7 +101,6 @@ pub enum Subcommands {
/// Otherwise the expansion mode is 'tree-traversal' by default.
tips: Vec<OsString>,
},
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableVersionFlag)]
#[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))]
PackReceive {
Expand Down Expand Up @@ -137,7 +134,6 @@ pub enum Subcommands {
///
/// This is the plumbing equivalent of `git ls-remote`.
/// Supported URLs are documented here: <https://www.git-scm.com/docs/git-clone#_git_urls>
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableVersionFlag)]
#[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))]
RemoteRefList {
Expand All @@ -150,7 +146,6 @@ pub enum Subcommands {
/// See here for a list of supported URLs: <https://www.git-scm.com/docs/git-clone#_git_urls>
url: String,
},
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableVersionFlag)]
PackIndexFromData {
/// Specify how to iterate the pack, defaults to 'verify'
Expand Down Expand Up @@ -181,7 +176,6 @@ pub enum Subcommands {
directory: Option<PathBuf>,
},
/// Verify the integrity of a pack or index file
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableVersionFlag)]
PackExplode {
#[clap(long)]
Expand Down Expand Up @@ -220,7 +214,6 @@ pub enum Subcommands {
object_path: Option<PathBuf>,
},
/// Verify the integrity of a pack or index file
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableVersionFlag)]
PackVerify {
/// output statistical information about the pack
Expand Down Expand Up @@ -256,7 +249,6 @@ pub enum Subcommands {
path: PathBuf,
},
/// Verify the integrity of a commit graph
#[clap(setting = AppSettings::ColoredHelp)]
#[clap(setting = AppSettings::DisableVersionFlag)]
CommitGraphVerify {
/// The path to '.git/objects/info/', '.git/objects/info/commit-graphs/', or '.git/objects/info/commit-graph' to validate.
Expand Down
2 changes: 1 addition & 1 deletion src/porcelain/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::{
};

use anyhow::Result;
use clap::Clap;
use clap::Parser;
use git_features::progress::DoOrDiscard;
use gitoxide_core as core;

Expand Down
20 changes: 9 additions & 11 deletions src/porcelain/options.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::{ffi::OsString, path::PathBuf};

use clap::{AppSettings, Clap};
use clap::AppSettings;

#[derive(Debug, Clap)]
#[derive(Debug, clap::Parser)]
#[clap(about = "The rusty git", version = clap::crate_version!())]
#[clap(setting = AppSettings::SubcommandRequired)]
#[clap(setting = AppSettings::ColoredHelp)]
pub struct Args {
/// Do not display verbose messages and progress information
#[clap(long, short = 'q')]
Expand All @@ -25,11 +24,11 @@ pub struct Args {
pub cmd: Subcommands,
}

#[derive(Debug, Clap)]
#[derive(Debug, clap::Parser)]
pub enum Subcommands {
/// Initialize the repository in the current directory.
#[clap(visible_alias = "initialize")]
#[clap(setting = AppSettings::ColoredHelp, setting = AppSettings::DisableVersionFlag)]
#[clap(setting = AppSettings::DisableVersionFlag)]
Init {
/// The directory in which to initialize a new git repository.
///
Expand All @@ -43,20 +42,20 @@ pub enum Subcommands {
Panic,
}

#[derive(Debug, Clap)]
#[clap(setting = AppSettings::ColoredHelp, setting = AppSettings::DisableVersionFlag, setting = AppSettings::SubcommandRequired)]
#[derive(Debug, clap::Parser)]
#[clap(setting = AppSettings::DisableVersionFlag, setting = AppSettings::SubcommandRequired)]
#[clap(visible_alias = "t")]
pub enum ToolCommands {
/// Find all repositories in a given directory.
#[clap(setting = AppSettings::ColoredHelp, setting = AppSettings::DisableVersionFlag)]
#[clap(setting = AppSettings::DisableVersionFlag)]
Find {
/// The directory in which to find all git repositories.
///
/// Defaults to the current working directory.
root: Option<PathBuf>,
},
/// Move all repositories found in a directory into a structure matching their clone URLs.
#[clap(setting = AppSettings::ColoredHelp, setting = AppSettings::DisableVersionFlag)]
#[clap(setting = AppSettings::DisableVersionFlag)]
Organize {
#[clap(long)]
/// The operation will be in dry-run mode unless this flag is set.
Expand All @@ -77,14 +76,13 @@ pub enum ToolCommands {
EstimateHours(EstimateHours),
}

#[derive(Debug, Clap)]
#[derive(Debug, clap::Parser)]
#[clap(
about = "Estimate hours worked based on a commit history",
long_about = "See https://github.com/kimmobrunfeldt/git-hours#how-it-works for details",
version = clap::crate_version!(),
visible_alias = "h")
]
#[clap(setting = clap::AppSettings::ColoredHelp)]
pub struct EstimateHours {
/// The directory containing a '.git/' folder.
#[clap(parse(from_os_str))]
Expand Down

0 comments on commit 2ddc4ed

Please sign in to comment.