Skip to content

Commit cc9e711

Browse files
committed
Upgrade database to clap 3.
Pretty minor stuff, mostly renamed functions.
1 parent 60df383 commit cc9e711

File tree

4 files changed

+17
-67
lines changed

4 files changed

+17
-67
lines changed

Cargo.lock

Lines changed: 5 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

database/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ futures = "0.3.5"
2525
log = "0.4"
2626
bytes = "1"
2727
csv = "1"
28-
clap = "2.25"
28+
clap = { version = "3.0.6", features = ["cargo"] }

database/src/bin/postgres-to-sqlite.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//! transactions, and will likely fail if used on a populated database.
55
66
use chrono::{DateTime, Utc};
7-
use clap::value_t;
87
use database::pool::{postgres, sqlite, ConnectionManager};
98
use futures::StreamExt;
109
use rusqlite::params;
@@ -464,8 +463,9 @@ async fn main() -> anyhow::Result<()> {
464463

465464
let matches = clap::App::new("postgres-to-sqlite")
466465
.about("Exports a rustc-perf Postgres database to a SQLite database")
466+
.version(clap::crate_version!())
467467
.arg(
468-
clap::Arg::with_name("exclude-tables")
468+
clap::Arg::new("exclude-tables")
469469
.long("exclude-tables")
470470
.takes_value(true)
471471
.value_name("TABLES")
@@ -474,24 +474,24 @@ async fn main() -> anyhow::Result<()> {
474474
.help("Exclude given tables (as foreign key constraints allow)"),
475475
)
476476
.arg(
477-
clap::Arg::with_name("no-self-profile")
477+
clap::Arg::new("no-self-profile")
478478
.long("no-self-profile")
479479
.help("Exclude some potentially large self-profile tables (additive with --exclude-tables)"),
480480
)
481481
.arg(
482-
clap::Arg::with_name("since-weeks-ago")
482+
clap::Arg::new("since-weeks-ago")
483483
.long("since-weeks-ago")
484484
.takes_value(true)
485485
.value_name("WEEKS")
486486
.help("Exclude data associated with artifacts whose date value precedes <WEEKS> weeks ago"),
487487
)
488488
.arg(
489-
clap::Arg::with_name("fast-unsafe")
489+
clap::Arg::new("fast-unsafe")
490490
.long("fast-unsafe")
491491
.help("Enable faster execution at the risk of corrupting SQLite database in the event of a crash"),
492492
)
493493
.arg(
494-
clap::Arg::with_name("postgres-db")
494+
clap::Arg::new("postgres-db")
495495
.required(true)
496496
.value_name("POSTGRES_DB")
497497
.help(
@@ -500,7 +500,7 @@ async fn main() -> anyhow::Result<()> {
500500
),
501501
)
502502
.arg(
503-
clap::Arg::with_name("sqlite-db")
503+
clap::Arg::new("sqlite-db")
504504
.required(true)
505505
.value_name("SQLITE_DB")
506506
.help("SQLite database file"),
@@ -521,7 +521,7 @@ async fn main() -> anyhow::Result<()> {
521521
// `RawSelfProfile` is intentionally kept.
522522
}
523523

524-
let since_weeks_ago = match clap::value_t!(matches, "since-weeks-ago", u32) {
524+
let since_weeks_ago = match matches.value_of_t("since-weeks-ago") {
525525
Ok(weeks) => Some(weeks),
526526
Err(err) if err.kind == clap::ErrorKind::ArgumentNotFound => None,
527527
Err(err) => err.exit(),

database/src/bin/sqlite-to-postgres.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,14 +614,15 @@ async fn main() -> anyhow::Result<()> {
614614

615615
let matches = clap::App::new("sqlite-to-postgres")
616616
.about("Exports a rustc-perf SQLite database to a Postgres database")
617+
.version(clap::crate_version!())
617618
.arg(
618-
clap::Arg::with_name("sqlite-db")
619+
clap::Arg::new("sqlite-db")
619620
.required(true)
620621
.value_name("SQLITE_DB")
621622
.help("SQLite database file"),
622623
)
623624
.arg(
624-
clap::Arg::with_name("postgres-db")
625+
clap::Arg::new("postgres-db")
625626
.required(true)
626627
.value_name("POSTGRES_DB")
627628
.help(

0 commit comments

Comments
 (0)