damus-github-export

Damus issue data exported from github
git clone git://jb55.com/damus-github-export
Log | Files | Refs | README | LICENSE

commit 87c86168e998b11136c77b75c8630c3e7fdddfa7
parent 66f15363511ff8c272844f527a4939996d8253a3
Author: Pierre-Rudolf Gerlach <pierrerudolf.gerlach@suricats-consulting.com>
Date:   Fri, 31 Mar 2023 04:08:21 +0200

feat: option "--csvDelimiter <delimiter>" (#86)

* feat: option "--csvDelimiter <delimiter>"

A lot of CVS files are deliimited by ';' and some softwares don't allow
exporting using ',' as a separator.

* doc: add option --csvDelimiter to README

* test: add file with semicolumn separator to test option csvDelimiter
Diffstat:
MREADME.md | 1+
Mimport.js | 1+
Mindex.js | 6+++++-
Atest/semicolonSeparator.csv | 4++++
4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md @@ -71,6 +71,7 @@ For all actions, the tool will ask you to input a GitHub token. To obtain this t | -t, --token | The GitHub token. <https://github.com/settings/tokens> | | -o, --organization | The User or Organization slug that the repo lives under. <br />Example: For `/myOrg/my-repo`, this value would be **myOrg**. | | -r, --repository | The repository name (slug).<br />Example: For `/myOrg/my-repo`, this value would be **my-repo**. | +| --csvDelimiter | The CSV delimiter character (defaults to ',') | | -v, --verbose | Include additional logging information. | | -h, --help | See all the options and help. | diff --git a/import.js b/import.js @@ -14,6 +14,7 @@ const importFile = (octokit, file, values) => { { trim: true, bom: true, + delimiter: values.csvDelimiter, }, (err, csvRows) => { if (err) throw err; diff --git a/index.js b/index.js @@ -35,7 +35,10 @@ program ) .option("-c, --exportComments", "Include comments in the export.") .option("-e, --exportAll", "Include all data in the export.") - .option("-v, --verbose", "Include additional logging information.") + .option( + "--csvDelimiter [csvDelimiter]", + "CSV delimiter character (defaults to ',')" + ) .option("-v, --verbose", "Include additional logging information.") .action(function (file, options) { co(function* () { const retObject = {}; @@ -56,6 +59,7 @@ program } retObject.exportComments = options.exportComments || false; retObject.exportAll = options.exportAll || false; + retObject.csvDelimiter = options.csvDelimiter || ','; retObject.verbose = options.verbose || false; retObject.userOrOrganization = options.organization || ""; diff --git a/test/semicolonSeparator.csv b/test/semicolonSeparator.csv @@ -0,0 +1,3 @@ +title;body;labels +Test 1; This is the test1 desc; bug +Test 2; This is the test2 desc; question+ \ No newline at end of file