From 265c04bf86317520293c390de3ba7f4522814a2b Mon Sep 17 00:00:00 2001 From: Emma Humphries Date: Mon, 23 May 2016 16:21:56 -0700 Subject: [PATCH 1/3] add command line script to fetch bug status --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d31ce13..1ff21e6 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,9 @@ "demo": "node test/fetch.js", "bundle-demo": "browserify test/fetch.js -o bugzilla-readable-status-browser-demo.js" }, + "bin": { + "readable-status": "bin/readable-status.js" + }, "repository": { "type": "git", "url": "git+https://github.com/emceeaich/bugzilla-readable-status.git" @@ -36,7 +39,8 @@ "test": "test" }, "dependencies": { + "browserify": "^13.0.1", "minifyify": "^7.3.3", - "browserify": "^13.0.1" + "node-fetch": "^1.5.2" } } From f8eed3fa2bbb22acbba6186a609031a0feb70b0e Mon Sep 17 00:00:00 2001 From: Emma Humphries Date: Fri, 8 Jul 2016 15:49:47 -0700 Subject: [PATCH 2/3] add command link script to repository --- bin/readable-status.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 bin/readable-status.js diff --git a/bin/readable-status.js b/bin/readable-status.js new file mode 100755 index 0000000..482a6f6 --- /dev/null +++ b/bin/readable-status.js @@ -0,0 +1,38 @@ +#! /usr/bin/env node + +var fetch = require('node-fetch'); +var readable = require('../index').readable; + +// check arguments + +if (process.argv.length < 3) { + process.exit(1); +} + +var args = process.argv.slice(2); +var bugid = args.shift(); + +// request bug + +fetch('https://bugzilla.mozilla.org/rest/bug/' + bugid). + then(function(res) { + if (res.ok) { + res.json().then(function(json) { + var bug = json.bugs.shift(); + var result = readable(bug); + if (result.error) { + console.log(result.error); + } else { + console.log(result); + } + }); + } else { + console.log(res.statusText); + process.exit(1); + } + }). + catch(function(error) { + console.log('Failed to reach bugzilla.mozilla.org.'); + process.exit(1); + }); + From 50dd29efab5b2b7a8598a1bea796a17b62063df6 Mon Sep 17 00:00:00 2001 From: Emma Humphries Date: Thu, 14 Jul 2016 14:51:21 -0700 Subject: [PATCH 3/3] display bug id and description along with status in command line tool --- bin/readable-status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/readable-status.js b/bin/readable-status.js index 482a6f6..939ea8c 100755 --- a/bin/readable-status.js +++ b/bin/readable-status.js @@ -23,7 +23,7 @@ fetch('https://bugzilla.mozilla.org/rest/bug/' + bugid). if (result.error) { console.log(result.error); } else { - console.log(result); + console.log(bug.id + ': ' + bug.summary + ': ' + result); } }); } else {