-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,5 @@ node_modules | |
# Optional REPL history | ||
.node_repl_history | ||
|
||
config.json | ||
config.json | ||
/lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
node ../lib/syrup.js "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,50 @@ | ||
{ | ||
"name": "syrup-cli", | ||
|
||
"version": "0.2.0", | ||
|
||
"description": "Scrum workflow CLI for Waffle.io", | ||
|
||
"main": "./src/syrup.js", | ||
|
||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/sap1ens/syrup" | ||
}, | ||
|
||
"bugs": { | ||
"url": "https://github.com/sap1ens/syrup/issues" | ||
}, | ||
|
||
"scripts": { | ||
"list-sprints": "node_modules/babel-cli/bin/babel-node.js src/syrup.js --command list-sprints", | ||
"new-sprint": "node_modules/babel-cli/bin/babel-node.js src/syrup.js --command new-sprint", | ||
"clone-issue": "node_modules/babel-cli/bin/babel-node.js src/syrup.js --command clone-issue", | ||
"help": "node_modules/babel-cli/bin/babel-node.js src/syrup.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
|
||
"author": { | ||
"name": "Yaroslav Tkachenko", | ||
"email": "[email protected]", | ||
"url": "http:https://sap1ens.com" | ||
}, | ||
|
||
"license": "MIT", | ||
|
||
"dependencies": { | ||
"babel-cli": "^6.6.5", | ||
"babel-preset-es2015": "^6.6.0", | ||
"cli-table": "^0.3.1", | ||
"github": "^0.2.4", | ||
"nconf": "^0.8.4", | ||
"underscore": "^1.8.3", | ||
"yargs-parser": "^2.4.0" | ||
} | ||
"name": "syrup-cli", | ||
"version": "0.2.0", | ||
"description": "Scrum workflow CLI for Waffle.io", | ||
"main": "./lib/syrup.js", | ||
"bin": { | ||
"syrup": "./bin/syrup" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/sap1ens/syrup" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/sap1ens/syrup/issues" | ||
}, | ||
"scripts": { | ||
"build": "node_modules/babel-cli/bin/babel.js src --out-dir lib", | ||
"prepublish": "node_modules/babel-cli/bin/babel.js src --out-dir lib", | ||
"start": "node_modules/babel-cli/bin/babel-node.js src/syrup.js", | ||
"list-sprints": "node_modules/babel-cli/bin/babel-node.js src/syrup.js --command list-sprints", | ||
"new-sprint": "node_modules/babel-cli/bin/babel-node.js src/syrup.js --command new-sprint", | ||
"clone-issue": "node_modules/babel-cli/bin/babel-node.js src/syrup.js --command clone-issue", | ||
"help": "node_modules/babel-cli/bin/babel-node.js src/syrup.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
] | ||
}, | ||
"author": { | ||
"name": "Yaroslav Tkachenko", | ||
"email": "[email protected]", | ||
"url": "http:https://sap1ens.com" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"cli-table": "^0.3.1", | ||
"commander": "^2.9.0", | ||
"github": "^0.2.4", | ||
"nconf": "^0.8.4", | ||
"underscore": "^1.8.3", | ||
"yargs-parser": "^2.4.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.9.0", | ||
"babel-core": "^6.9.1", | ||
"babel-preset-es2015": "^6.9.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,37 @@ | ||
import sprints from './features/list-sprints'; | ||
import newSprint from './features/new-sprint'; | ||
import cloneIssue from './features/clone-issue'; | ||
import yargsParser from 'yargs-parser'; | ||
import program from 'commander'; | ||
|
||
const argv = yargsParser(process.argv.slice(2)); | ||
|
||
switch(argv.command) { | ||
case 'list-sprints': | ||
program | ||
.command('list-sprints') | ||
.description('list all existing Sprints') | ||
.action(() => { | ||
sprints(); | ||
break; | ||
case 'new-sprint': | ||
const nameSuffix = argv.id; | ||
newSprint(nameSuffix); | ||
break; | ||
case 'clone-issue': | ||
const repo = argv.repo; | ||
const issueId = argv.id; | ||
cloneIssue(repo, issueId); | ||
break; | ||
case 'help': | ||
default: | ||
console.log(`Choose the following commands: | ||
npm run list-sprints - list all existing Sprints | ||
npm run new-sprint -- --id $SPRINT_ID - create new Sprint using unique SPRINT_ID | ||
npm run clone-issue -- --repo $REPO_NAME --id $ISSUE_ID - clone issue using provided repo and issue ID | ||
npm run help`); | ||
} | ||
}); | ||
|
||
program | ||
.command('new-sprint') | ||
.description('create new Sprint using unique sprint_id') | ||
.option('-i, --id', 'sprint ID') | ||
.action((id) => { | ||
newSprint(id); | ||
}); | ||
|
||
program | ||
.command('clone-issue') | ||
.description('clone issue using provided repo and issue ID') | ||
.option('-i, --id', 'issue ID') | ||
.option('-r, --repo', 'repository name') | ||
.action((id, repo) => { | ||
cloneIssue(repo, id); | ||
}); | ||
|
||
// kinda hacky, but there is no other way to replace the whole thing | ||
program.helpInformation = () => { | ||
return 'TODO'; | ||
}; | ||
|
||
program.parse(process.argv); | ||
|
||
if (!program.args.length) program.help(); |