New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bug-task

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bug-task - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

27

index.js

@@ -10,12 +10,18 @@ #!/usr/bin/env node

var opts = nomnom.parse();
var opts = nomnom
.script('bugtask')
.options({
bugs: {
position: 0,
help: 'Bug numbers to add tasks for.',
list: true,
required: true,
},
})
.parse();
var bugzilla = PromiseProxy(Promise, bz.createClient());
var error = false;
if (opts._.length === 0) {
console.log('Usage:', process.argv[0], 'BUG [BUG ...]');
process.exit(1);
}
Promise.all(opts._.map(function(bugNo) {
Promise.all(opts.bugs.map(function(bugNo) {
return bugzilla.getBug(bugNo)

@@ -27,8 +33,7 @@ .then(function(bug) {

})
.then(function() {
console.log(bugNo, '✓');
.then(function(task) {
console.log('Bug ' + bugNo + ': Added task ' + task.id);
})
.catch(function(err) {
console.log(bugNo, '✗');
console.error(err);
console.log('Bug ' + bugNo + ' ', err.message);
error = true;

@@ -35,0 +40,0 @@ });

@@ -5,15 +5,5 @@ var spawn = require('child_process').spawn;

function addTask(opts) {
if (!('description' in opts)) {
throw new Error('No description given for task.');
}
function _task(args) {
args = args || [];
var args = ['add'];
for (var key in opts) {
if (!opts.hasOwnProperty(key)) {
continue;
}
args.push(key + ':' + opts[key]);
}
return new Promise(function(resolve, reject) {

@@ -50,4 +40,33 @@ var tw = spawn('task', args);

function addTask(opts) {
if (!('description' in opts)) {
throw new Error('No description given for task.');
}
var args = ['add'];
for (var key in opts) {
if (!opts.hasOwnProperty(key)) {
continue;
}
args.push(key + ':' + opts[key]);
}
return _task(args)
.then(function(data) {
var match = data.stdout.match(/Created task (\d+)\./);
if (match) {
var id = match[1];
return new Task(id);
} else {
throw new Error('Unknown output "' + data.stdout + '".');
}
});
}
function Task(id) {
this.id = id;
}
module.exports = {
addTask: addTask,
};
{
"name": "bug-task",
"version": "0.0.1",
"version": "0.0.2",
"description": "Add taskwarrior tasks from Bugzilla IDs.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc