Use clap's dynamic String feature rather than another dependency

pull/813/head
Wilfred Hughes 2025-01-03 21:33:05 +07:00
parent 2c1feaedbf
commit 44be153e7d
3 changed files with 5 additions and 34 deletions

27
Cargo.lock generated

@ -176,26 +176,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "const_format"
version = "0.2.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673"
dependencies = [
"const_format_proc_macros",
]
[[package]]
name = "const_format_proc_macros"
version = "0.2.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
@ -266,7 +246,6 @@ dependencies = [
"bumpalo",
"cc",
"clap",
"const_format",
"crossterm",
"glob",
"hashbrown",
@ -1286,12 +1265,6 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "unicode-xid"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "utf8parse"
version = "0.2.2"

@ -35,7 +35,7 @@ pkg-fmt = "zip"
[dependencies]
regex = "1.10.4"
clap = { version = "4.0.0", features = ["cargo", "env", "wrap_help"] }
clap = { version = "4.0.0", features = ["cargo", "env", "wrap_help", "string"] }
itertools = "0.11.0"
typed-arena = "2.0.2"
rustc-hash = "2.0.0"
@ -55,7 +55,6 @@ radix-heap = "0.4.2"
# a slightly more aggressive MSRV than difftastic. Constrain ignore to
# a known-good max version.
ignore = ">= 0.4, < 0.4.24"
const_format = "0.2.22"
owo-colors = "3.5.0"
wu-diff = "0.1.2"
rayon = "1.7.0"

@ -8,7 +8,6 @@ use std::{
};
use clap::{crate_authors, crate_description, value_parser, Arg, ArgAction, Command};
use const_format::formatcp;
use crossterm::tty::IsTty;
use itertools::Itertools;
@ -169,7 +168,7 @@ fn app() -> clap::Command {
.action(ArgAction::Set)
.long_help("Treat a tab as this many spaces.")
.env("DFT_TAB_WIDTH")
.default_value(formatcp!("{}", DEFAULT_TAB_WIDTH))
.default_value(format!("{}", DEFAULT_TAB_WIDTH))
.value_parser(clap::value_parser!(usize))
.required(false),
)
@ -287,7 +286,7 @@ When multiple overrides are specified, the first matching override wins."))
.value_name("LIMIT")
.action(ArgAction::Set)
.help("Use a text diff if either input file exceeds this size.")
.default_value(formatcp!("{}", DEFAULT_BYTE_LIMIT))
.default_value(format!("{}", DEFAULT_BYTE_LIMIT))
.env("DFT_BYTE_LIMIT")
.value_parser(clap::value_parser!(usize))
.required(false),
@ -296,7 +295,7 @@ When multiple overrides are specified, the first matching override wins."))
Arg::new("graph-limit").long("graph-limit")
.value_name("LIMIT")
.help("Use a text diff if the structural graph exceed this number of nodes in memory.")
.default_value(formatcp!("{}", DEFAULT_GRAPH_LIMIT))
.default_value(format!("{}", DEFAULT_GRAPH_LIMIT))
.action(ArgAction::Set)
.env("DFT_GRAPH_LIMIT")
.value_parser(clap::value_parser!(usize))
@ -307,7 +306,7 @@ When multiple overrides are specified, the first matching override wins."))
.value_name("LIMIT")
.action(ArgAction::Set)
.help("Use a text diff if the number of parse errors exceeds this value.")
.default_value(formatcp!("{}", DEFAULT_PARSE_ERROR_LIMIT))
.default_value(format!("{}", DEFAULT_PARSE_ERROR_LIMIT))
.env("DFT_PARSE_ERROR_LIMIT")
.value_parser(clap::value_parser!(usize))
.required(false),