BurntSushi / xsv

A fast CSV command line toolkit written in Rust.
The Unlicense
10.31k stars 317 forks source link

Documentation #220

Open fuzzy76 opened 4 years ago

fuzzy76 commented 4 years ago

I really wish there was more documentation than a readme. Preferably a longer description of each command with a list of available options for each command (with a description) and examples for each. Sort of like csvkit has.

BurntSushi commented 4 years ago

Sure, and I wish I had the time to do it. Each command does come with its own docs, even if they are a bit short.

Yomguithereal commented 4 years ago

I could spend some time to draft a more comprehensive documentation if you want @BurntSushi

ColonelBuendia commented 4 years ago

Perhaps adding an exlicit mention of the xsv [command] help parameter into the readme somewhere near the top might be enough.

Concatetenating them together could also be the man page and it would be a very good one at that.

Each command has quite useful and concise explanations under xsv [command] -h or xsv [command --help and this is mentioned not only in the intial invocation from the cli, but also from the command invocations, though to my embarrassment I would say I used xsv for maybe a year before actually putting it together and starting to use them. After using those help docs, 99% of my questions were answered.

Sample output for anyone who doesn't have the tool in front of them.

xsv join -h

Joins two sets of CSV data on the specified columns.

The default join operation is an 'inner' join. This corresponds to the
intersection of rows on the keys specified.

Joins are always done by ignoring leading and trailing whitespace. By default,
joins are done case sensitively, but this can be disabled with the --no-case
flag.

The columns arguments specify the columns to join for each input. Columns can
be referenced by name or index, starting at 1. Specify multiple columns by
separating them with a comma. Specify a range of columns with `-`. Both
columns1 and columns2 must specify exactly the same number of columns.
(See 'xsv select --help' for the full syntax.)

Usage:
    xsv join [options] <columns1> <input1> <columns2> <input2>
    xsv join --help

join options:
    --no-case              When set, joins are done case insensitively.
    --left                 Do a 'left outer' join. This returns all rows in
                           first CSV data set, including rows with no
                           corresponding row in the second data set. When no
                           corresponding row exists, it is padded out with
                           empty fields.
    --right                Do a 'right outer' join. This returns all rows in
                           second CSV data set, including rows with no
                           corresponding row in the first data set. When no
                           corresponding row exists, it is padded out with
                           empty fields. (This is the reverse of 'outer left'.)
    --full                 Do a 'full outer' join. This returns all rows in
                           both data sets with matching records joined. If
                           there is no match, the missing side will be padded
                           out with empty fields. (This is the combination of
                           'outer left' and 'outer right'.)
    --cross                USE WITH CAUTION.
                           This returns the cartesian product of the CSV
                           data sets given. The number of rows return is
                           equal to N * M, where N and M correspond to the
                           number of rows in the given data sets, respectively.
    --nulls                When set, joins will work on empty fields.
                           Otherwise, empty fields are completely ignored.
                           (In fact, any row that has an empty field in the
                           key specified is ignored.)

Common options:
    -h, --help             Display this message
    -o, --output <file>    Write output to <file> instead of stdout.
    -n, --no-headers       When set, the first row will not be interpreted
                           as headers. (i.e., They are not searched, analyzed,
                           sliced, etc.)
    -d, --delimiter <arg>  The field delimiter for reading CSV data.
                           Must be a single character. (default: ,)

Sample output

jeanlucaslima commented 2 years ago

Is anyone writing the man files? I can help with it