Skip to content

Commit 87c8616

Browse files
authored
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
1 parent 66f1536 commit 87c8616

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ For all actions, the tool will ask you to input a GitHub token. To obtain this t
7171
| -t, --token | The GitHub token. <https://github.com/settings/tokens> |
7272
| -o, --organization | The User or Organization slug that the repo lives under. <br />Example: For `/myOrg/my-repo`, this value would be **myOrg**. |
7373
| -r, --repository | The repository name (slug).<br />Example: For `/myOrg/my-repo`, this value would be **my-repo**. |
74+
| --csvDelimiter | The CSV delimiter character (defaults to ',') |
7475
| -v, --verbose | Include additional logging information. |
7576
| -h, --help | See all the options and help. |
7677

import.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const importFile = (octokit, file, values) => {
1414
{
1515
trim: true,
1616
bom: true,
17+
delimiter: values.csvDelimiter,
1718
},
1819
(err, csvRows) => {
1920
if (err) throw err;

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ program
3535
)
3636
.option("-c, --exportComments", "Include comments in the export.")
3737
.option("-e, --exportAll", "Include all data in the export.")
38-
.option("-v, --verbose", "Include additional logging information.")
38+
.option(
39+
"--csvDelimiter [csvDelimiter]",
40+
"CSV delimiter character (defaults to ',')"
41+
) .option("-v, --verbose", "Include additional logging information.")
3942
.action(function (file, options) {
4043
co(function* () {
4144
const retObject = {};
@@ -56,6 +59,7 @@ program
5659
}
5760
retObject.exportComments = options.exportComments || false;
5861
retObject.exportAll = options.exportAll || false;
62+
retObject.csvDelimiter = options.csvDelimiter || ',';
5963
retObject.verbose = options.verbose || false;
6064

6165
retObject.userOrOrganization = options.organization || "";

test/semicolonSeparator.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
title;body;labels
2+
Test 1; This is the test1 desc; bug
3+
Test 2; This is the test2 desc; question

0 commit comments

Comments
 (0)