Copy/Paste in node

818 views
Skip to first unread message

Xavi Ramirez

unread,
Aug 24, 2012, 2:31:25 PM8/24/12
to nod...@googlegroups.com
I was recently doing a lot of work in REPL and I found myself
constantly needing to copy/paste various bits of input/output from my
text editor to the REPL and vise versa. Using the mouse got pretty
tedious, so I created a quick module called node-copy-paste that wraps
pbpaste/pbcopy (as well as xclip [linux] and clip [windows]):

https://github.com/xavi-/node-copy-paste

Thought I'd share it with you guys.

Thanks,
Xavi

Domenic Denicola

unread,
Aug 25, 2012, 1:25:47 AM8/25/12
to nod...@googlegroups.com
Very cool; I'm a big fan of these kind of utilities. See e.g. https://github.com/domenic/opener

A few points of constructive criticism:
* Putting "node-" in the package name is generally bad practice. As a GitHub repo name it's fine, but in package.json it should be just "copy-paste"
* Exposing global functions is not great either. Why not just export the `copy` and `paste` methods from your package's main module?

Xavi Ramirez

unread,
Aug 25, 2012, 12:08:30 PM8/25/12
to nod...@googlegroups.com
Good first point, I'll make the change.

As for the second point, I expose `copy` and `paste` globally for the
sake of connivence. When I'm in the REPL, I simply what to type
`require("copy-paste)` and be done with it. Connivence is also why
`paste` synchronously returns a value instead of using a callback.
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
Reply all
Reply to author
Forward
0 new messages