diff --git a/README.md b/README.md index bdd1fd1..68991e2 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ foo,bar ``` ```shell -❯ pqrs cat data/simple.parquet --csv-no-header +❯ pqrs cat data/simple.parquet --csv --no-header 1,2 10,20 ``` diff --git a/src/commands/cat.rs b/src/commands/cat.rs index d3c3f96..8ccfaaa 100644 --- a/src/commands/cat.rs +++ b/src/commands/cat.rs @@ -13,15 +13,15 @@ use walkdir::WalkDir; #[derive(Parser, Debug)] pub struct CatCommandArgs { /// Use CSV format for printing - #[clap(short, long, conflicts_with_all = &["csv-no-header","json"])] + #[clap(short, long, conflicts_with = "json")] csv: bool, /// Use CSV format without a header for printing - #[clap(long = "csv-no-header", conflicts_with_all = &["csv","json"])] + #[clap(long = "no-header", requires = "csv", conflicts_with = "json")] csv_no_header: bool, /// Use JSON lines format for printing - #[clap(short, long, conflicts_with_all = &["csv", "csv-no-header"])] + #[clap(short, long, conflicts_with = "csv")] json: bool, /// Parquet files or folders to read from @@ -31,10 +31,10 @@ pub struct CatCommandArgs { pub(crate) fn execute(opts: CatCommandArgs) -> Result<(), PQRSError> { let format = if opts.json { Formats::Json - } else if opts.csv { - Formats::Csv } else if opts.csv_no_header { Formats::CsvNoHeader + } else if opts.csv { + Formats::Csv } else { Formats::Default }; diff --git a/tests/integration.rs b/tests/integration.rs index 691aa37..2e4e9aa 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -81,7 +81,8 @@ mod integration { let mut cmd = Command::cargo_bin("pqrs")?; cmd.arg("cat") .arg(SIMPLE_PARQUET_PATH) - .arg("--csv-no-header"); + .arg("--csv") + .arg("--no-header"); cmd.assert() .success() .stdout(predicate::str::starts_with(CAT_CSV_NO_HEADER_OUTPUT));