summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2022-11-30 07:04:19 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2022-12-01 06:27:39 +0000
commitfb48f92c8092c5b9de8e15c0cb477efd1b7a6785 (patch)
tree64ecd8b3a2e6a36e34882ef93dcfcb5dfa148bd5
parentb65b621b7215d1873df9dce11f195d9bbd68ebe4 (diff)
downloadsubplot-fb48f92c8092c5b9de8e15c0cb477efd1b7a6785.tar.gz
(chore): Update to clap4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r--Cargo.lock121
-rw-r--r--Cargo.toml2
-rw-r--r--src/bin/cli/mod.rs3
-rw-r--r--src/bin/subplot.rs25
4 files changed, 123 insertions, 28 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 395c659..befad05 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -34,7 +34,7 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
- "hermit-abi",
+ "hermit-abi 0.1.19",
"libc",
"winapi",
]
@@ -95,8 +95,8 @@ checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
dependencies = [
"atty",
"bitflags",
- "clap_derive",
- "clap_lex",
+ "clap_derive 3.2.18",
+ "clap_lex 0.2.4",
"indexmap",
"once_cell",
"strsim",
@@ -105,6 +105,21 @@ dependencies = [
]
[[package]]
+name = "clap"
+version = "4.0.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
+dependencies = [
+ "bitflags",
+ "clap_derive 4.0.21",
+ "clap_lex 0.3.0",
+ "is-terminal",
+ "once_cell",
+ "strsim",
+ "termcolor",
+]
+
+[[package]]
name = "clap_derive"
version = "3.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -118,6 +133,19 @@ dependencies = [
]
[[package]]
+name = "clap_derive"
+version = "4.0.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014"
+dependencies = [
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -127,6 +155,15 @@ dependencies = [
]
[[package]]
+name = "clap_lex"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
+dependencies = [
+ "os_str_bytes",
+]
+
+[[package]]
name = "cpufeatures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -224,6 +261,27 @@ dependencies = [
]
[[package]]
+name = "errno"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
+dependencies = [
+ "errno-dragonfly",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "errno-dragonfly"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
name = "fastrand"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -407,6 +465,15 @@ dependencies = [
]
[[package]]
+name = "hermit-abi"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
+dependencies = [
+ "libc",
+]
+
+[[package]]
name = "humansize"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -456,6 +523,28 @@ dependencies = [
]
[[package]]
+name = "io-lifetimes"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "is-terminal"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
+dependencies = [
+ "hermit-abi 0.2.6",
+ "io-lifetimes",
+ "rustix",
+ "windows-sys",
+]
+
+[[package]]
name = "itertools"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -489,6 +578,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
+name = "linux-raw-sys"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
+
+[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -558,7 +653,7 @@ version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
dependencies = [
- "hermit-abi",
+ "hermit-abi 0.1.19",
"libc",
]
@@ -855,7 +950,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f0c08002dd427499194cef0e292cfd515281777d5b9cc4c638028d2d3aebda4"
dependencies = [
"anyhow",
- "clap",
+ "clap 3.2.23",
"serde",
"serde_yaml",
"textwrap 0.15.2",
@@ -863,6 +958,20 @@ dependencies = [
]
[[package]]
+name = "rustix"
+version = "0.36.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
+dependencies = [
+ "bitflags",
+ "errno",
+ "io-lifetimes",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys",
+]
+
+[[package]]
name = "rustversion"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1016,7 +1125,7 @@ version = "0.6.0"
dependencies = [
"anyhow",
"base64",
- "clap",
+ "clap 4.0.29",
"env_logger",
"file_diff",
"git-testament",
diff --git a/Cargo.toml b/Cargo.toml
index 737ce02..6aa3727 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,7 +25,7 @@ ast_08 = ["pandoc_ast_08"]
[dependencies]
anyhow = "1"
base64 = "0.13.0"
-clap = { version = "3", features = ["derive", "env"] }
+clap = { version = "4", features = ["derive", "env", "string"] }
file_diff = "1"
git-testament = "0.2"
lazy_static = "1"
diff --git a/src/bin/cli/mod.rs b/src/bin/cli/mod.rs
index e78a92d..4e15efb 100644
--- a/src/bin/cli/mod.rs
+++ b/src/bin/cli/mod.rs
@@ -3,6 +3,7 @@
#![allow(unused)]
use anyhow::Result;
+use clap::ValueEnum;
use log::trace;
use serde::Serialize;
use std::fmt::Debug;
@@ -125,7 +126,7 @@ fn filename(name: Option<&Path>) -> String {
}
}
-#[derive(Debug)]
+#[derive(Debug, ValueEnum, Clone, Copy)]
pub enum OutputFormat {
Plain,
Json,
diff --git a/src/bin/subplot.rs b/src/bin/subplot.rs
index 8ede58d..b86c613 100644
--- a/src/bin/subplot.rs
+++ b/src/bin/subplot.rs
@@ -136,13 +136,7 @@ struct Extract {
merciful: bool,
/// Directory to write extracted files to
- #[clap(
- name = "DIR",
- long = "directory",
- short = 'd',
- parse(from_os_str),
- default_value = "."
- )]
+ #[clap(name = "DIR", long = "directory", short = 'd', default_value = ".")]
directory: PathBuf,
/// Don't actually write the files out
@@ -150,7 +144,6 @@ struct Extract {
dry_run: bool,
/// Input subplot document filename
- #[clap(parse(from_os_str))]
filename: PathBuf,
/// Names of embedded files to be extracted.
@@ -202,11 +195,10 @@ struct Metadata {
merciful: bool,
/// Form that you want the output to take
- #[clap(short = 'o', default_value = "plain", possible_values=&["plain", "json"])]
+ #[clap(short = 'o', default_value = "plain")]
output_format: cli::OutputFormat,
/// Input subplot document filename
- #[clap(parse(from_os_str))]
filename: PathBuf,
}
@@ -242,11 +234,10 @@ struct Docgen {
template: Option<String>,
// Input Subplot document
- #[clap(parse(from_os_str))]
input: PathBuf,
// Output document filename
- #[clap(name = "FILE", long = "output", short = 'o', parse(from_os_str))]
+ #[clap(name = "FILE", long = "output", short = 'o')]
output: PathBuf,
// Set date.
@@ -358,16 +349,10 @@ struct Codegen {
template: Option<String>,
/// Input filename.
- #[clap(parse(from_os_str))]
filename: PathBuf,
/// Write generated test program to this file.
- #[clap(
- long,
- short,
- parse(from_os_str),
- help = "Writes generated test program to FILE"
- )]
+ #[clap(long, short, help = "Writes generated test program to FILE")]
output: PathBuf,
/// Run the generated test program after writing it?
@@ -456,7 +441,7 @@ fn real_main() {
info!("Starting Subplot");
let argparser = Toplevel::command();
let version = long_version().unwrap();
- let argparser = argparser.long_version(version.as_str());
+ let argparser = argparser.long_version(version);
let args = argparser.get_matches();
let args = Toplevel::from_arg_matches(&args).unwrap();
args.handle_special_args();