Skip to content

Commit

Permalink
use raw strings for usage text everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Nov 21, 2022
1 parent 3099c9b commit 5d0ba0c
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions src/cmd/behead.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Drop a CSV file's header.
Usage:
Expand All @@ -8,7 +8,7 @@ Usage:
Common options:
-h, --help Display this message
-o, --output <file> Write output to <file> instead of stdout.
";
"#;

use serde::Deserialize;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/cat.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Concatenates CSV data by column or by row.
When concatenating by column, the columns will be written in the same order as
Expand Down Expand Up @@ -30,7 +30,7 @@ Common options:
concatenating columns.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use serde::Deserialize;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/count.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Prints a count of the number of records in the CSV data.
Note that the count will not include the header row (unless --no-headers is
Expand All @@ -17,7 +17,7 @@ Common options:
-h, --help Display this message
-n, --no-headers When set, the first row will be included in
the count.
";
"#;

use log::info;
use serde::Deserialize;
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/exclude.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Removes a set of CSV data from another set based on the specified columns.
Also can compute the intersection of two CSV sets with the -v flag.
Expand Down Expand Up @@ -30,7 +30,7 @@ Common options:
sliced, etc.)
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::{collections::hash_map::Entry, fmt, fs, io, str};

Expand Down
6 changes: 3 additions & 3 deletions src/cmd/explode.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Explodes a row into multiple ones by splitting a column value based on the
given separator.
Expand All @@ -8,7 +8,7 @@ name,colors
John,blue|yellow
Mary,red
Can be exploded on the \"colors\" <column> based on the \"|\" <separator> to:
Can be exploded on the "colors" <column> based on the "|" <separator> to:
name,colors
John,blue
Expand All @@ -29,7 +29,7 @@ Common options:
as headers.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use serde::Deserialize;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/extsort.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Sort an arbitrarily large CSV/text file using a multithreaded external sort algorithm.
This command does not work with <stdin>/<stdout>. Valid input, and output
Expand All @@ -23,7 +23,7 @@ Common options:
as headers and will be sorted with the rest
of the rows. Otherwise, the first row will always
appear as the header row in the output.
";
"#;

use std::{
fs,
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/fill.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Fill empty fields in selected columns of a CSV.
This command fills empty fields in the selected column
Expand Down Expand Up @@ -47,7 +47,7 @@ Common options:
sliced, etc.)
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::{io, iter, ops};

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/fixlengths.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Transforms CSV data so that all records have the same length. The length is
the length of the longest record in the data (not counting trailing empty fields,
but at least 1). Records with smaller lengths are padded with empty fields.
Expand All @@ -24,7 +24,7 @@ Common options:
-o, --output <file> Write output to <file> instead of stdout.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::cmp;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/flatten.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Prints flattened records such that fields are labeled separated by a new line.
This mode is particularly useful for viewing one record at a time. Each
record is separated by a special '#' character (on a line by itself), which
Expand Down Expand Up @@ -28,7 +28,7 @@ Common options:
will be its index.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::{
borrow::Cow,
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/fmt.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Formats CSV data with a custom delimiter or CRLF line endings.
Generally, all commands in qsv output CSV data in a default format, which is
Expand All @@ -14,9 +14,9 @@ Usage:
fmt options:
-t, --out-delimiter <arg> The field delimiter for writing CSV data.
[default: ,]
--crlf Use '\\r\\n' line endings in the output.
--crlf Use '\r\n' line endings in the output.
--ascii Use ASCII field and record separators.
--quote <arg> The quote character to use. [default: \"]
--quote <arg> The quote character to use. [default: "]
--quote-always Put quotes around every value.
--quote-never Never put quotes around any value.
--escape <arg> The escape character to use. When not specified,
Expand All @@ -27,7 +27,7 @@ Common options:
-o, --output <file> Write output to <file> instead of stdout.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use serde::Deserialize;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/foreach.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg(target_family = "unix")]
static USAGE: &str = "
static USAGE: &str = r#"
Execute a bash command once per line in given CSV file. Works only in
Unix-like environments.
Expand Down Expand Up @@ -33,7 +33,7 @@ Common options:
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
-p, --progressbar Show progress bars. Not valid for stdin.
";
"#;

use std::{
ffi::OsStr,
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/frequency.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Compute a frequency table on CSV data.
The frequency table is formatted as CSV data:
Expand Down Expand Up @@ -44,7 +44,7 @@ Common options:
names.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::{fs, io};

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/headers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Prints the fields of the first row in the CSV data.
These names can be used in commands like 'select' to refer to columns in the
Expand All @@ -22,7 +22,7 @@ Common options:
-h, --help Display this message
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::io;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/index.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Creates an index of the given CSV data, which can make other operations like
slicing, splitting and gathering statistics much faster.
Expand All @@ -24,7 +24,7 @@ index options:
Common options:
-h, --help Display this message
";
"#;

use std::{
fs, io,
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/jsonl.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Convert newline-delimited JSON (JSONL/NDJSON) to CSV.
The command tries to do its best but since it is not possible to
Expand All @@ -18,7 +18,7 @@ jsonl options:
Common options:
-h, --help Display this message
-o, --output <file> Write output to <file> instead of stdout.
";
"#;

use std::{
fs,
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/partition.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Partitions the given CSV data into chunks based on the value of a column
The files are written to the output directory with filenames based on the
Expand Down Expand Up @@ -26,7 +26,7 @@ Common options:
appear in all chunks as the header row.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::{
collections::{hash_map::Entry, HashSet},
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/pseudo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Pseudonymise the value of the given column by replacing them by an
incremental identifier.
Expand All @@ -13,7 +13,7 @@ Common options:
as headers.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use ahash::AHashMap;
use serde::Deserialize;
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/reverse.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Reverses rows of CSV data.
Useful for cases when there is no column that can be used for sorting in reverse order,
Expand All @@ -19,7 +19,7 @@ Common options:
appear as the header row in the output.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use serde::Deserialize;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/slice.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Returns the rows in the range specified (starting at 0, half-open interval).
The range does not include headers.
Expand Down Expand Up @@ -33,7 +33,7 @@ Common options:
appear in the output as the header row.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::fs;

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/split.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Splits the given CSV data into chunks.
The files are written to the directory given with the name '{start}.csv',
Expand Down Expand Up @@ -33,7 +33,7 @@ Common options:
appear in all chunks as the header row.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::{fs, io, path::Path};

Expand Down
6 changes: 3 additions & 3 deletions src/cmd/table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Outputs CSV data as a table with columns in alignment.
This will not work well if the CSV data contains large fields.
Expand All @@ -17,7 +17,7 @@ table options:
-p, --pad <arg> The minimum number of spaces between each column.
[default: 2]
-a, --align <arg> How entries should be aligned in a column.
Options: \"left\", \"right\", \"center\".
Options: "left", "right", "center".
[default: left]
-c, --condense <arg> Limits the length of each field to the value
specified. If the field is UTF-8 encoded, then
Expand All @@ -29,7 +29,7 @@ Common options:
-o, --output <file> Write output to <file> instead of stdout.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::{borrow::Cow, convert::From};

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/transpose.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static USAGE: &str = "
static USAGE: &str = r#"
Transpose the rows/columns of CSV data.
Note that by default this reads all of the CSV data into memory,
Expand All @@ -21,7 +21,7 @@ Common options:
-o, --output <file> Write output to <file> instead of stdout.
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. (default: ,)
";
"#;

use std::str;

Expand Down

0 comments on commit 5d0ba0c

Please sign in to comment.