Skip to content

Commit bc6e6a0

Browse files
committed
verneuilctl: update to clap v4
Mostly, we don't need explicit parsing for paths.
1 parent 12272a8 commit bc6e6a0

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ blake2b_simd = { version = "1", optional = true }
6161
chrono = { version = "0.4", features = ["serde"] }
6262
# Having dev dependencies as optional makes it possible to
6363
# build verneuil's examples out of tree.
64-
clap = { version = "3", optional = true }
64+
clap = { version = "4", optional = true }
6565
crossbeam-channel = "0.5"
6666
derivative = "2"
6767
governor = { version = "0.6", default-features = false, features = ["std"] }
@@ -93,7 +93,7 @@ zstd = "0.13"
9393
rusqlite = { version = "0.26" } # For the sample rusqlite_integration.
9494
tracing-subscriber = { version = "0.3", features = ["env-filter", "tracing-log"] } # Examples set up tracing.
9595

96-
clap = { version = "3", features = ["derive"] }
96+
clap = { version = "4", features = ["derive"] }
9797
test_dir = "0.2"
9898

9999
[build-dependencies]

examples/verneuilctl.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ struct Restore {
123123

124124
/// The path to the source file that was replicated by Verneuil,
125125
/// when it ran on `--hostname`.
126-
#[clap(short, long, parse(from_os_str))]
126+
#[clap(short, long)]
127127
source_path: Option<PathBuf>,
128128

129129
/// The path to the reconstructed output file.
130130
///
131131
/// Defaults to stdout.
132-
#[clap(short, long, parse(from_os_str))]
132+
#[clap(short, long)]
133133
out: Option<PathBuf>,
134134
}
135135

@@ -181,7 +181,6 @@ fn restore(cmd: Restore, config: Options) -> Result<()> {
181181
/// the corresponding manifest file to stdout.
182182
struct ManifestName {
183183
/// The path to the source file that was replicated by Verneuil.
184-
#[clap(parse(from_os_str))]
185184
source: PathBuf,
186185

187186
/// The hostname (/etc/hostname) of the machine that replicated
@@ -205,7 +204,6 @@ fn manifest_name(cmd: ManifestName) -> Result<()> {
205204
/// of the corresponding manifest file to `--out`, or stdout by default.
206205
struct Manifest {
207206
/// The path to the source file that was replicated by Verneuil.
208-
#[clap(parse(from_os_str))]
209207
source: PathBuf,
210208

211209
/// The hostname (/etc/hostname) of the machine that replicated
@@ -216,7 +214,7 @@ struct Manifest {
216214
/// The path to the output manifest file.
217215
///
218216
/// Defaults to stdout.
219-
#[clap(short, long, parse(from_os_str))]
217+
#[clap(short, long)]
220218
out: Option<PathBuf>,
221219
}
222220

@@ -239,7 +237,6 @@ fn manifest(cmd: Manifest, config: Options) -> Result<()> {
239237
/// attempts to upload all the files pending replication in that directory.
240238
struct Flush {
241239
/// The replication spooling directory prefix.
242-
#[clap(parse(from_os_str))]
243240
spooling: PathBuf,
244241
}
245242

@@ -254,7 +251,6 @@ fn flush(cmd: Flush) -> Result<()> {
254251
/// On success, prints the manifest name to stdout.
255252
struct Sync {
256253
/// The source sqlite database file.
257-
#[clap(parse(from_os_str))]
258254
source: PathBuf,
259255

260256
/// Whether to optimize the database before uploading it.
@@ -314,7 +310,7 @@ fn sync(cmd: Sync, config: Options) -> Result<()> {
314310
}
315311

316312
#[derive(Debug, Parser)]
317-
#[clap(setting = clap::AppSettings::TrailingVarArg)]
313+
#[clap(trailing_var_arg = true)]
318314
/// The verneuilctl shell utility accepts the path to a verneuil
319315
/// manifest file, and opens the snapshot it describes in the sqlite
320316
/// shell.
@@ -346,7 +342,7 @@ struct Shell {
346342

347343
/// The path to the source file that was replicated by Verneuil,
348344
/// when it ran on `--hostname`.
349-
#[clap(short, long, parse(from_os_str))]
345+
#[clap(short, long)]
350346
source_path: Option<PathBuf>,
351347

352348
/// The path to the sqlite3 shell executable; defaults to

0 commit comments

Comments
 (0)