this repo has no description

feat: switch to clap

As far as I can tell, `argh` doesn't support multicall binaries, I could
try to hack my own support, or we can swit to clap.

The size difference isn't too much:

| build | size (release) |
|-----------------------------------|---------------:|
| `argh` | `513KB` |
| `clap` (default-features = false) | `628KB` |
| `clap` (default-features = true) | `731KB` |

+123 -34
+116 -25
Cargo.lock
··· 18 18 checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 19 19 20 20 [[package]] 21 - name = "argh" 22 - version = "0.1.13" 21 + name = "anstream" 22 + version = "0.6.18" 23 23 source = "registry+https://github.com/rust-lang/crates.io-index" 24 - checksum = "34ff18325c8a36b82f992e533ece1ec9f9a9db446bd1c14d4f936bac88fcd240" 24 + checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" 25 25 dependencies = [ 26 - "argh_derive", 27 - "argh_shared", 28 - "rust-fuzzy-search", 26 + "anstyle", 27 + "anstyle-parse", 28 + "anstyle-query", 29 + "anstyle-wincon", 30 + "colorchoice", 31 + "is_terminal_polyfill", 32 + "utf8parse", 29 33 ] 30 34 31 35 [[package]] 32 - name = "argh_derive" 33 - version = "0.1.13" 36 + name = "anstyle" 37 + version = "1.0.11" 34 38 source = "registry+https://github.com/rust-lang/crates.io-index" 35 - checksum = "adb7b2b83a50d329d5d8ccc620f5c7064028828538bdf5646acd60dc1f767803" 39 + checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" 40 + 41 + [[package]] 42 + name = "anstyle-parse" 43 + version = "0.2.6" 44 + source = "registry+https://github.com/rust-lang/crates.io-index" 45 + checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" 46 + dependencies = [ 47 + "utf8parse", 48 + ] 49 + 50 + [[package]] 51 + name = "anstyle-query" 52 + version = "1.1.2" 53 + source = "registry+https://github.com/rust-lang/crates.io-index" 54 + checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" 36 55 dependencies = [ 37 - "argh_shared", 38 - "proc-macro2", 39 - "quote", 40 - "syn", 56 + "windows-sys 0.59.0", 41 57 ] 42 58 43 59 [[package]] 44 - name = "argh_shared" 45 - version = "0.1.13" 60 + name = "anstyle-wincon" 61 + version = "3.0.7" 46 62 source = "registry+https://github.com/rust-lang/crates.io-index" 47 - checksum = "a464143cc82dedcdc3928737445362466b7674b5db4e2eb8e869846d6d84f4f6" 63 + checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" 48 64 dependencies = [ 49 - "serde", 65 + "anstyle", 66 + "once_cell", 67 + "windows-sys 0.59.0", 50 68 ] 51 69 52 70 [[package]] ··· 71 89 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 72 90 73 91 [[package]] 92 + name = "clap" 93 + version = "4.5.40" 94 + source = "registry+https://github.com/rust-lang/crates.io-index" 95 + checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" 96 + dependencies = [ 97 + "clap_builder", 98 + "clap_derive", 99 + ] 100 + 101 + [[package]] 102 + name = "clap_builder" 103 + version = "4.5.40" 104 + source = "registry+https://github.com/rust-lang/crates.io-index" 105 + checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" 106 + dependencies = [ 107 + "anstream", 108 + "anstyle", 109 + "clap_lex", 110 + "strsim", 111 + ] 112 + 113 + [[package]] 114 + name = "clap_derive" 115 + version = "4.5.40" 116 + source = "registry+https://github.com/rust-lang/crates.io-index" 117 + checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" 118 + dependencies = [ 119 + "heck", 120 + "proc-macro2", 121 + "quote", 122 + "syn", 123 + ] 124 + 125 + [[package]] 126 + name = "clap_lex" 127 + version = "0.7.5" 128 + source = "registry+https://github.com/rust-lang/crates.io-index" 129 + checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" 130 + 131 + [[package]] 74 132 name = "color-eyre" 75 133 version = "0.6.4" 76 134 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 96 154 "tracing-core", 97 155 "tracing-error", 98 156 ] 157 + 158 + [[package]] 159 + name = "colorchoice" 160 + version = "1.0.3" 161 + source = "registry+https://github.com/rust-lang/crates.io-index" 162 + checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" 99 163 100 164 [[package]] 101 165 name = "eyre" ··· 114 178 checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" 115 179 116 180 [[package]] 181 + name = "heck" 182 + version = "0.5.0" 183 + source = "registry+https://github.com/rust-lang/crates.io-index" 184 + checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 185 + 186 + [[package]] 117 187 name = "humansize" 118 188 version = "2.1.3" 119 189 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 129 199 checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" 130 200 131 201 [[package]] 202 + name = "is_terminal_polyfill" 203 + version = "1.70.1" 204 + source = "registry+https://github.com/rust-lang/crates.io-index" 205 + checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 206 + 207 + [[package]] 132 208 name = "itoa" 133 209 version = "1.0.15" 134 210 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 156 232 name = "lix-diff" 157 233 version = "1.0.1" 158 234 dependencies = [ 159 - "argh", 235 + "clap", 160 236 "color-eyre", 161 237 "humansize", 162 238 "nu-ansi-term", ··· 185 261 source = "registry+https://github.com/rust-lang/crates.io-index" 186 262 checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" 187 263 dependencies = [ 188 - "windows-sys", 264 + "windows-sys 0.52.0", 189 265 ] 190 266 191 267 [[package]] ··· 234 310 ] 235 311 236 312 [[package]] 237 - name = "rust-fuzzy-search" 238 - version = "0.1.1" 239 - source = "registry+https://github.com/rust-lang/crates.io-index" 240 - checksum = "a157657054ffe556d8858504af8a672a054a6e0bd9e8ee531059100c0fa11bb2" 241 - 242 - [[package]] 243 313 name = "rustc-demangle" 244 314 version = "0.1.24" 245 315 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 293 363 ] 294 364 295 365 [[package]] 366 + name = "strsim" 367 + version = "0.11.1" 368 + source = "registry+https://github.com/rust-lang/crates.io-index" 369 + checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 370 + 371 + [[package]] 296 372 name = "syn" 297 373 version = "2.0.101" 298 374 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 361 437 checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 362 438 363 439 [[package]] 440 + name = "utf8parse" 441 + version = "0.2.2" 442 + source = "registry+https://github.com/rust-lang/crates.io-index" 443 + checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 444 + 445 + [[package]] 364 446 name = "valuable" 365 447 version = "0.1.1" 366 448 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 371 453 version = "0.52.0" 372 454 source = "registry+https://github.com/rust-lang/crates.io-index" 373 455 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 456 + dependencies = [ 457 + "windows-targets", 458 + ] 459 + 460 + [[package]] 461 + name = "windows-sys" 462 + version = "0.59.0" 463 + source = "registry+https://github.com/rust-lang/crates.io-index" 464 + checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 374 465 dependencies = [ 375 466 "windows-targets", 376 467 ]
+2 -3
Cargo.toml
··· 8 8 edition = "2024" 9 9 10 10 [dependencies] 11 - argh = "0.1.13" 11 + clap = { version = "4.5.40", features = ["derive"] } 12 12 color-eyre = "0.6.4" 13 13 humansize = "2.1.3" 14 14 nu-ansi-term = "0.50.1" 15 - serde = "1.0.219" 15 + serde = { version = "1.0.219", features = ["derive"] } 16 16 serde_json = "1.0.140" 17 17 18 18 [lints.clippy] ··· 26 26 codegen-units = 1 27 27 panic = "abort" 28 28 strip = true 29 -
+5 -6
src/main.rs
··· 1 1 use std::{env, path::PathBuf}; 2 2 3 - use argh::FromArgs; 3 + use clap::Parser; 4 4 use color_eyre::Result; 5 5 use diff::PackageListDiff; 6 6 use nu_ansi_term::{Color, Style}; ··· 12 12 13 13 use self::parser::DiffRoot; 14 14 15 - #[derive(FromArgs, PartialEq, Debug)] 15 + #[derive(Parser, PartialEq, Debug)] 16 16 /// List the package differences between two `NixOS` generations 17 17 struct Args { 18 18 /// the path to the lix bin directory 19 - #[argh(option, short = 'l')] 19 + #[arg(short, long)] 20 20 lix_bin: Option<PathBuf>, 21 21 22 22 /// the generation we are switching from 23 - #[argh(positional)] 24 23 before: PathBuf, 25 24 26 25 /// the generation we are switching to 27 - #[argh(positional, default = "PathBuf::from(\"/run/current-system/\")")] 26 + #[arg(default_value = "/run/current-system/")] 28 27 after: PathBuf, 29 28 } 30 29 31 30 fn main() -> Result<()> { 32 - let args: Args = argh::from_env(); 31 + let args = Args::parse(); 33 32 let before = args.before; 34 33 let after = args.after; 35 34 let lix_bin = args.lix_bin;