diff --git a/jsonschema/Cargo.toml b/jsonschema/Cargo.toml index 990c8f80..3d3e1892 100644 --- a/jsonschema/Cargo.toml +++ b/jsonschema/Cargo.toml @@ -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" diff --git a/jsonschema/src/main.rs b/jsonschema/src/main.rs index a8d17b09..127fa962 100644 --- a/jsonschema/src/main.rs +++ b/jsonschema/src/main.rs @@ -6,24 +6,24 @@ use std::{ process, }; +use clap::Parser; use jsonschema::JSONSchema; -use structopt::StructOpt; type BoxErrorResult = Result>; -#[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>, /// 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, /// Show program's version number and exit. - #[structopt(short = "v", long = "version")] + #[clap(short = 'v', long = "version")] version: bool, }