Comparing version 0.1.0 to 0.1.1
@@ -24,5 +24,7 @@ (function() { | ||
program = new Command; | ||
program.version("0.1.0").usage("[options] [key] [value]").option("-d, --delete", "delete the specified key").parse(args); | ||
program.version("0.1.1").usage("[options] [key] [value]").option("-d, --delete", "delete the specified key").option("-h, --help", "get help").parse(args); | ||
_ref = program.args, key = _ref[0], value = _ref[1]; | ||
if (key && program["delete"]) { | ||
if (program.help) { | ||
return this.log(program.helpInformation()); | ||
} else if (key && program["delete"]) { | ||
return this["delete"](key); | ||
@@ -33,8 +35,6 @@ } else if (key && value) { | ||
return this.get(key); | ||
} else if (Object.keys(this.data).length === 0) { | ||
return this.log(program.helpInformation()); | ||
} else { | ||
if (Object.keys(this.data).length === 0) { | ||
return this.log(program.helpInformation()); | ||
} else { | ||
return this.list(); | ||
} | ||
return this.list(); | ||
} | ||
@@ -69,3 +69,4 @@ }; | ||
this.copy(value); | ||
return this.log(value); | ||
this.log(value); | ||
return value; | ||
}; | ||
@@ -75,3 +76,4 @@ | ||
this.data[key] = value; | ||
return this.save(); | ||
this.save(); | ||
return this; | ||
}; | ||
@@ -81,7 +83,8 @@ | ||
delete this.data[key]; | ||
return this.save(); | ||
this.save(); | ||
return this; | ||
}; | ||
Bang.prototype.list = function() { | ||
var amount, key, _results; | ||
var amount, key; | ||
amount = 0; | ||
@@ -91,7 +94,6 @@ for (key in this.data) { | ||
} | ||
_results = []; | ||
for (key in this.data) { | ||
_results.push(this.log("" + (this.pad(key, amount)) + key + ": " + this.data[key])); | ||
this.log("" + (this.pad(key, amount)) + key + ": " + this.data[key]); | ||
} | ||
return _results; | ||
return this; | ||
}; | ||
@@ -102,5 +104,6 @@ | ||
copyCommand = os.type().match(/darwin/i) ? "pbcopy" : "xclip -selection clipboard"; | ||
return exec("printf '" + (value.replace(/\'/g, "\\'")) + "' | " + copyCommand, function(error, stdout, stderr) { | ||
exec("printf '" + (value.replace(/\'/g, "\\'")) + "' | " + copyCommand, function(error, stdout, stderr) { | ||
if (error) throw error; | ||
}); | ||
return this; | ||
}; | ||
@@ -107,0 +110,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Text snippets on the command line.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/jimmycuadra/bang", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -31,2 +31,4 @@ # Bang | ||
The value is copied to your clipboard. | ||
## Delete a snippet | ||
@@ -33,0 +35,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
34686
11
281
59
2