Permalink
Browse files

shorten readme extension, add optional callback to copy function, fix…

… broken paste function
  • Loading branch information...
1 parent fbccaae commit 406c7d67e87ae5bbb8f68224cbbc0284a3ceeef9 Jeff Escalante committed May 10, 2013
Showing with 7 additions and 4 deletions.
  1. +2 −0 .gitignore
  2. 0 README.markdown → README.md
  3. +5 −4 index.js
View
@@ -0,0 +1,2 @@
+.DS_Store
+node_modules
File renamed without changes.
View
@@ -20,12 +20,13 @@ switch(process.platform) {
var _copy = GLOBAL.copy, _paste = GLOBAL.paste;
-var copy = GLOBAL.copy = exports.copy = function(text) {
+var copy = GLOBAL.copy = exports.copy = function(text, cb) {
var child = spawn(config.copy.command, config.copy.args);
+
child
- .on("exit", function() { console.log("Copy complete"); })
- .stderr.on("data", function(err) { console.error(err.toString()); });
+ .on("exit", function() { cb ? cb() : console.log("Copy complete"); })
+ .stderr.on("data", function(err) { cb ? (err) : console.error(err.toString()); });
if(text.pipe) { text.pipe(child.stdin); }
else {
@@ -42,7 +43,7 @@ var copy = GLOBAL.copy = exports.copy = function(text) {
var pasteCommand = [ config.paste.command ].concat(config.paste.args).join(" ");
var paste = GLOBAL.paste = exports.paste = function() {
- return execSync(pasteCommand);
+ return execSync.exec(pasteCommand).stdout;
};
exports.noConflict = function() {

0 comments on commit 406c7d6

Please sign in to comment.