Skip to content

Commit

Permalink
Merge pull request #21 from juan-riveros/shunt-cat-header-to-stderr
Browse files Browse the repository at this point in the history
Moved cat "header" to stderr for easier piping
  • Loading branch information
manojkarthick authored Dec 8, 2021
2 parents bdc6ad2 + a2b256f commit 62d6438
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/commands/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ impl<'a> PQRSCommand for CatCommand<'a> {
let file = open_file(file_name)?;
let info_string = format!("File: {}", file_name);
let length = info_string.len();
println!("\n{}", "#".repeat(length));
println!("{}", info_string);
println!("{}\n", "#".repeat(length));
eprintln!("\n{}", "#".repeat(length));
eprintln!("{}", info_string);
eprintln!("{}\n", "#".repeat(length));
print_rows(file, None, self.format)?;
}

Expand Down
8 changes: 3 additions & 5 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ static CAT_JSON_OUTPUT: &'static str = r#"{"continent":"Europe","country":{"name
{"continent":"Europe","country":{"name":"Greece","city":["Athens","Piraeus","Hania","Heraklion","Rethymnon","Fira"]}}
{"continent":"North America","country":{"name":"Canada","city":["Toronto","Vancouver","St. John's","Saint John","Montreal","Halifax","Winnipeg","Calgary","Saskatoon","Ottawa","Yellowknife"]}}
"#;
static CAT_CSV_OUTPUT: &'static str = r#"
foo,bar
static CAT_CSV_OUTPUT: &'static str = r#"foo,bar
1,2
10,20
"#;
10,20"#;
static SCHEMA_OUTPUT: &'static str = r#"message hive_schema {
OPTIONAL BYTE_ARRAY continent (UTF8);
OPTIONAL group country {
Expand Down Expand Up @@ -81,7 +79,7 @@ mod integration {
cmd.arg("cat").arg("data");
cmd.assert()
.success()
.stdout(predicate::str::contains("cities.parquet").and(
.stderr(predicate::str::contains("cities.parquet").and(
predicate::str::contains("simple.parquet").and(
predicate::str::contains("pems-1.snappy.parquet").and(
predicate::str::contains("pems-2.snappy.parquet")
Expand Down

0 comments on commit 62d6438

Please sign in to comment.