damus-github-export

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

commit 6c0cf49bdfdf87f00d1c94d0c9758b076ef5cd6e
parent 817c30e2a28cd6b5d3f5d1ba2808cf613aafd62b
Author: Gavin Rehkemper <gavinr@users.noreply.github.com>
Date:   Sun, 23 Aug 2020 11:25:08 -0500

Merge pull request #25 from gavinr/additional-options

allow passing of org/user and repo via commandline options
Diffstat:
MREADME.md | 14++++++++------
Mindex.js | 17+++++++++++++++--
2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -47,12 +47,14 @@ For all actions, the tool will ask you to input a GitHub token. To obtain this t ## Other Options -| Option | Notes | -| ----------------------- | ---------------------------------------------------- | -| -V, --version | output the version number | -| -g, --github_enterprise | Your GitHub Enterprise URL. | -| -t, --token | The GitHub token. https://github.com/settings/tokens | -| -h, --help | See all the options and help. | +| Option | Notes | +| ----------------------- | -------------------------------------------------------- | +| -V, --version | output the version number | +| -g, --github_enterprise | Your GitHub Enterprise URL. | +| -t, --token | The GitHub token. https://github.com/settings/tokens | +| -o, --organization | The User or Organization slug that the repo lives under. | +| -r, --repository | The repository name (slug). | +| -h, --help | See all the options and help. | ## Development diff --git a/index.js b/index.js @@ -22,6 +22,11 @@ program "The GitHub token. https://github.com/settings/tokens" ) .option( + "-o, --organization [organization]", + "The User or Organization slug that the repo lives under." + ) + .option("-r, --repository [repository]", "The repository name (slug).") + .option( "-f, --exportFileName [export.csv]", "The name of the CSV you'd like to export to." ) @@ -49,8 +54,16 @@ program .map((i) => i.trim()); } retObject.exportComments = options.exportComments || false; - retObject.userOrOrganization = yield prompt("user or organization: "); - retObject.repo = yield prompt("repo: "); + + retObject.userOrOrganization = options.organization || ""; + if (retObject.userOrOrganization === "") { + retObject.userOrOrganization = yield prompt("user or organization: "); + } + + retObject.repo = options.repository || ""; + if (retObject.repo === "") { + retObject.repo = yield prompt("repository: "); + } return retObject; }).then( function (values) {