Skip to content

Commit

Permalink
Upgrade to clap 3.0.0-beta.5
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceadams committed Oct 31, 2021
1 parent 5e66405 commit ced2fa2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 45 deletions.
76 changes: 41 additions & 35 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ repository = "https://github.com/bruceadams/yj"

[dependencies]
exitfailure = "0.5.1"
serde_json = "1.0.67"
serde_yaml = "0.8.20"
serde_json = "1.0.68"
serde_yaml = "0.8.21"
snafu = "0.6.10"

[dependencies.clap]
features = ["wrap_help"]
version = "3.0.0-beta.4"
version = "3.0.0-beta.5"
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use clap::{crate_description, crate_version, AppSettings::ColoredHelp, Clap};
use clap::{crate_description, crate_version, Parser};
use exitfailure::ExitFailure;
use snafu::{ResultExt, Snafu};
use std::{
Expand Down Expand Up @@ -51,15 +51,15 @@ enum Error {
},
}

#[derive(Clap, Clone, Debug)]
#[clap(global_setting = ColoredHelp, about=crate_description!(), version=crate_version!())]
#[derive(Clone, Debug, Parser)]
#[clap(about=crate_description!(), version=crate_version!())]
struct MyArgs {
/// Use compact formatting for the JSON output.
#[clap(long = "compact", short = 'c')]
#[clap(long, short)]
compact: bool,

/// Format the output as YAML instead of JSON.
#[clap(long = "yaml", short = 'y')]
#[clap(long, short)]
yaml: bool,

/// Parse the input as JSON.
Expand All @@ -68,11 +68,11 @@ struct MyArgs {
/// correctly even when being handled with the YAML parser.
/// Use this option when you want failure (instead of weird results)
/// when the input is invalid JSON.
#[clap(long = "json", short = 'j')]
#[clap(long, short)]
json: bool,

/// Output file name for the JSON. Defaults to stdout.
#[clap(long = "output", parse(from_os_str), short = 'o')]
#[clap(long, parse(from_os_str), short)]
output: Option<PathBuf>,

/// Input YAML file name. Defaults to stdin.
Expand Down

0 comments on commit ced2fa2

Please sign in to comment.