Inconsistent `zsv help <command>` formatting
iamazeem opened this issue · 0 comments
iamazeem commented
Environment
- OS: Ubuntu 22.04 LTS
- zsv: v0.3.8-alpha
Description
The help output for some commands seems to be inconsistent in terms of:
- line length
- indentation of the flag description
- space between short and long flags
- placement of colon after flag
- missing description
- duplicate description
- argument format (underscore vs space)
- argument case mismatch (lowercase vs the rest)
Here are such observed instances:
zsv help
(indentation)
zsv (un)register [<extension_id>]: (un)register an extension
Registration info is saved in zsv.ini located in a directory determined as:
ZSV_CONFIG_DIR environment variable value, if set
otherwise, /usr/local/etc
-u,--malformed-utf8-replacement <replacement_string>: replacement string (can be empty) in case of malformed UTF8 input
(default for "desc" commamnd is '?')
zsv help select
(indentation, colon placement)
Usage: select [filename] [options] [-- col_specifier [... col_specifier]]
where col_specifier is a column name or, if the -n option is used,
a column index (starting at 1) or index range in the form of n-m
e.g. select -n myfile.csv -- 1 4-6 50 10
select myfile.csv -- first_col fiftieth_column "Tenth Column"
-e <embedded lineend char> : char to replace embedded lineend. if none provided, embedded lineends are preserved
If the provided string begins with 0x, it will be interpreted as the hex representation of a string
-n: provided column indexes are numbers corresponding to column positions (starting with 1), instead of names
--whitespace-clean-no-newline: clean whitespace and remove embedded newlines
-W,--no-trim: do not trim whitespace
-o <output filename>: name of file to save output to
zsv help sql
(indentation, colon placement)
sql: run ad hoc sql on a CSV file
or join multiple CSV files on one or more common column(s)
Options:
--join-indexes <n1...>: specify one or more column names to join multiple files by
each n is treated as an index in the first input file that determines a column
of the join. For example, if joining two files that, respectively, have columns
A,B,C,D and X,B,C,A,Y then `--join-indexes 1,3` will join on columns A and C.
When using this option, do not include an sql statement
-b: output with BOM
zsv help count
(missing description, one space indentation whereas others have two, redundant square brackets)
Usage: count [options]
Options:
-h, --help : show usage
[-i, --input] <filename>: use specified file input
zsv help desc
(colon placement)
Options:
-b, --with-bom : output with BOM
-C <maximum_number_of_columns>: defaults to 1024
-H: only output header names
-q, --quick: minimize example counts,
-a, --all: calculate all metadata (for now, this only adds uniqueness info)
-o <output filename>: name of file to save output to (defaults to stdout)
zsv help pretty
(indentation, double colons)
-W, --width <n>: set the max line width to output. if not provided
will try to detect automatically
-p, --rows: : set the number of (preview) rows to calculated widths from
if not provided, defaults to 150
zsv help flatten
(long description, formatting of flags, colon placement)
flatten: flatten a table, based on a single-column key assuming that rows to flatten always appear in contiguous blocks
Usage: flatten [<filename>] [<options>] -- [aggregate_output_spec ...]
Each aggregate output specification is either (i) a single-column aggregation or (future: (ii) the "*" placeholder (in conjunction with -a)).
A single-column aggregation consists of the column name or index, followed by the equal sign (=) and then an aggregation method.
If the equal sign should be part of the column name, it can be escaped with a preceding backslash.
The following aggregation methods may be used: array (pipe-delimited)
array_<delim> (user-specified delimiter)
Options:
-b: output with BOM
-v, --verbose: display verbose messages
-C <max columns to output>: maximum number of columns to output
-m <max rows per aggregation>: defaults to 1024. If this limit is reached for any aggregation,
an error will be output
--row-id <Row ID column name>: Required. name of column to group by
--col-name <Column ID column name>: name of column specifying the output column name
-V <Value column name>: name of column specifying the output value
(future: -a <Aggregation method>: aggregation method to use for the select-all placeholder)
-o <output filename>: name of file to save output to
zsv help 2json
(flags: extra space after comma)
Options:
-h, --help
-o, --output <filename> : output to specified filename
zsv help 2tsv
(indentation)
2tsv: convert CSV to TSV (tab-delimited text) suitable for simple-delimiter
text processing. By default, embedded tabs or multilines will be escaped
to \t, \n or \r, respectively
zsv help serialize
(duplicate description)
serialize: Serialize a CSV file into Row/Colname/Value triplets
Usage: serialize [<filename>]
Serializes a CSV file
zsv help stack
(flags)
zsv help stack
stack: stack one or more csv files vertically, aligning columns with the same name
Usage: stack [options] filename [filename...]
Options:
-o <filename>: output file
-b: output with BOM
-q: always add double-quotes
-T: input is tab-delimited, instead of comma-delimited
zsv help compare
(missing description)
Usage: compare [options] [file1.csv] [file2.csv] [...]
There may be other instances too.