Skip to content

Commit 617715f

Browse files
committed
rename cli command
1 parent b0e94d4 commit 617715f

4 files changed

Lines changed: 21 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ default-members = ["."]
99

1010
[package]
1111
name = "commonmeta"
12-
version = "0.4.1"
12+
version = "0.4.2"
1313
edition = "2024"
1414
authors = ["Front Matter <info@front-matter.de>"]
1515
description = "Library for conversions to/from the Commonmeta scholarly metadata format"

src/cmd/dump.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
use clap::{Arg, ArgMatches, Command};
66
use commonmeta::file_utils;
7+
use std::time::Instant;
78

89
/// Default Parquet row-group size — 10 000 rows per group keeps memory
910
/// pressure manageable for large VRAIX daily dumps (millions of rows).
1011
const DEFAULT_BATCH_SIZE: usize = 10_000;
1112

1213
pub fn command() -> Command {
13-
Command::new("dump")
14+
Command::new("package")
1415
.about("Write a VRAIX SQLite dump as a Parquet file")
1516
.long_about(
1617
"Read a VRAIX transport table from a local SQLite3 file and write \
@@ -26,11 +27,11 @@ pub fn command() -> Command {
2627
.parquet.zip ZIP archive containing the Parquet file\n\
2728
.parquet.tgz tar+gzip archive containing the Parquet file\n\n\
2829
Examples:\n\n\
29-
commonmeta dump crossref-2026-06-15.sqlite3\n\
30-
commonmeta dump crossref-2026-06-15.sqlite3 --file crossref-2026-06-15.parquet\n\
31-
commonmeta dump crossref-2026-06-15.sqlite3 --file crossref-2026-06-15.parquet.zst\n\
32-
commonmeta dump crossref-2026-06-15.sqlite3 --file crossref-2026-06-15.parquet.zip\n\
33-
commonmeta dump crossref-2026-06-15.sqlite3 --batch-size 50000",
30+
commonmeta package crossref-2026-06-15.sqlite3\n\
31+
commonmeta package crossref-2026-06-15.sqlite3 --file crossref-2026-06-15.parquet\n\
32+
commonmeta package crossref-2026-06-15.sqlite3 --file crossref-2026-06-15.parquet.zst\n\
33+
commonmeta package crossref-2026-06-15.sqlite3 --file crossref-2026-06-15.parquet.zip\n\
34+
commonmeta package crossref-2026-06-15.sqlite3 --batch-size 50000 --timer",
3435
)
3536
.arg(
3637
Arg::new("input")
@@ -54,9 +55,17 @@ pub fn command() -> Command {
5455
.help("Rows per Parquet row group (default: 10000)")
5556
.value_parser(clap::value_parser!(usize)),
5657
)
58+
.arg(
59+
Arg::new("timer")
60+
.long("timer")
61+
.help("Print total packaging duration to stderr")
62+
.action(clap::ArgAction::SetTrue),
63+
)
5764
}
5865

5966
pub fn execute(matches: &ArgMatches) -> Result<(), String> {
67+
let timer = matches.get_flag("timer");
68+
let started = Instant::now();
6069
let input = matches.get_one::<String>("input").expect("required");
6170
let batch_size = matches
6271
.get_one::<usize>("batch_size")
@@ -74,6 +83,9 @@ pub fn execute(matches: &ArgMatches) -> Result<(), String> {
7483
write_output(&bytes, &out_path)?;
7584

7685
eprintln!("wrote {} rows → {}", parquet_row_count(&bytes), out_path);
86+
if timer {
87+
eprintln!("package timer: {:?}", started.elapsed());
88+
}
7789

7890
Ok(())
7991
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn main() -> Result<(), String> {
2525
Some(("analyze", sub_matches)) => cmd::analyze::execute(sub_matches),
2626
Some(("convert", sub_matches)) => cmd::convert::execute(sub_matches),
2727
Some(("decode", sub_matches)) => cmd::decode::execute(sub_matches),
28-
Some(("dump", sub_matches)) => cmd::dump::execute(sub_matches),
28+
Some(("package", sub_matches)) => cmd::dump::execute(sub_matches),
2929
Some(("encode", sub_matches)) => cmd::encode::execute(sub_matches),
3030
Some(("list", sub_matches)) => cmd::list::execute(sub_matches),
3131
Some(("push", sub_matches)) => cmd::push::execute(sub_matches),

0 commit comments

Comments
 (0)