Skip to content

Commit

Permalink
chore: Replace structopt with clap (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
Expyron authored Oct 18, 2022
1 parent 81e988e commit 07be2ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions jsonschema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ categories = ["web-programming"]
name = "jsonschema"

[features]
cli = ["structopt"]
cli = ["clap"]
default = ["resolve-http", "resolve-file", "cli"]
draft201909 = []
draft202012 = []
Expand All @@ -29,6 +29,7 @@ ahash = { version = "0.7.6", features = ["serde"] }
anyhow = "1.0.55"
base64 = "0.13.0"
bytecount = { version = "0.6.2", features = ["runtime-dispatch-simd"] }
clap = { version = "3.2", features = ["derive"], optional = true }
fancy-regex = "0.10.0"
fraction = { version = "0.10.0", default-features = false, features = ["with-bigint"] }
iso8601 = "0.4.1"
Expand All @@ -42,7 +43,6 @@ regex = "1.5.4"
reqwest = { version = "0.11.9", features = ["blocking", "json"], default-features = false, optional = true }
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
structopt = { version = "0.3.26", optional = true }
time = { version = "0.3.7", features = ["parsing", "macros"] }
url = "2.2.2"
uuid = "1.0.0"
Expand Down
12 changes: 6 additions & 6 deletions jsonschema/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ use std::{
process,
};

use clap::Parser;
use jsonschema::JSONSchema;
use structopt::StructOpt;

type BoxErrorResult<T> = Result<T, Box<dyn Error>>;

#[derive(Debug, StructOpt)]
#[structopt(name = "jsonschema")]
#[derive(Parser)]
#[clap(name = "jsonschema")]
struct Cli {
/// A path to a JSON instance (i.e. filename.json) to validate (may be specified multiple times).
#[structopt(short = "i", long = "instance")]
#[clap(short = 'i', long = "instance")]
instances: Option<Vec<PathBuf>>,

/// The JSON Schema to validate with (i.e. schema.json).
#[structopt(parse(from_os_str), required_unless("version"))]
#[clap(parse(from_os_str), required_unless("version"))]
schema: Option<PathBuf>,

/// Show program's version number and exit.
#[structopt(short = "v", long = "version")]
#[clap(short = 'v', long = "version")]
version: bool,
}

Expand Down

0 comments on commit 07be2ff

Please sign in to comment.