From d8faaeba30b77617285a3f195360c655a0c428be Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Fri, 1 Dec 2023 14:03:39 -0600 Subject: [PATCH] Updates README for CLI Signed-off-by: Jesse Donat --- README.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 18bcf12..7da1e57 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,38 @@ Requires **no external libraries**. Works in Node as well as in the browser. ## Install -``` +```bash npm install csv-to-markdown-table ``` ## Usage +### CLI + +This package also includes a CLI tool. You can install it globally with: + +```bash +npm install -g csv-to-markdown-table +``` + +Then you can use it like so: + +```bash +$ csvtomarkdown --help +Usage: csvtomarkdown [options] +// … help output + +$ csvtomarkdown --delimiter ',' --headers < example.csv +| cats | dogs | fish | +|------|------|------| +| 1 | 2 | 3 | +| 4 | 5 | 6 | +$ csvtomarkdown +Reading from stdin... (press Ctrl+D at the start of a line to finish) +CSV Delimiter: \t (tab) Headers: false +[interactive input] +``` + ### Raw JS via Global ```js @@ -49,7 +75,7 @@ console.log( #### Outputs: -``` +```markdown | header1 | header2 | header3 | |---------|---------|---------| | Value1 | Value2 | Value3 |