chore: Replace `structopt` with `clap` (#384)
This commit is contained in:
parent
81e988e089
commit
07be2ffaf1
|
@ -16,7 +16,7 @@ categories = ["web-programming"]
|
|||
name = "jsonschema"
|
||||
|
||||
[features]
|
||||
cli = ["structopt"]
|
||||
cli = ["clap"]
|
||||
default = ["resolve-http", "resolve-file", "cli"]
|
||||
draft201909 = []
|
||||
draft202012 = []
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue