pax_global_header00006660000000000000000000000064125152555740014525gustar00rootroot0000000000000052 comment=15200af2c417c65a4df153f39f32143dcd476375 node-editor-1.0.0/000077500000000000000000000000001251525557400137345ustar00rootroot00000000000000node-editor-1.0.0/LICENSE000066400000000000000000000021611251525557400147410ustar00rootroot00000000000000Copyright 2013 James Halliday (mail@substack.net) This project is free software released under the MIT license: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. node-editor-1.0.0/README.markdown000066400000000000000000000012151251525557400164340ustar00rootroot00000000000000editor ====== Launch $EDITOR in your program. example ======= ``` js var editor = require('editor'); editor('beep.json', function (code, sig) { console.log('finished editing with code ' + code); }); ``` *** ``` $ node edit.js ``` ![editor](http://substack.net/images/screenshots/editor.png) ``` finished editing with code 0 ``` methods ======= ``` js var editor = require('editor') ``` editor(file, opts={}, cb) ------------------------- Launch the `$EDITOR` (or `opts.editor`) for `file`. When the editor exits, `cb(code, sig)` fires. install ======= With [npm](http://npmjs.org) do: ``` npm install editor ``` license ======= MIT node-editor-1.0.0/example/000077500000000000000000000000001251525557400153675ustar00rootroot00000000000000node-editor-1.0.0/example/beep.json000066400000000000000000000000441251525557400171730ustar00rootroot00000000000000{ "a" : 3, "b" : 4, "c" : 5 } node-editor-1.0.0/example/edit.js000066400000000000000000000002201251525557400166440ustar00rootroot00000000000000var editor = require('../'); editor(__dirname + '/beep.json', function (code, sig) { console.log('finished editing with code ' + code); }); node-editor-1.0.0/index.js000066400000000000000000000011231251525557400153760ustar00rootroot00000000000000var spawn = require('child_process').spawn; module.exports = function (file, opts, cb) { if (typeof opts === 'function') { cb = opts; opts = {}; } if (!opts) opts = {}; var ed = /^win/.test(process.platform) ? 'notepad' : 'vim'; var editor = opts.editor || process.env.VISUAL || process.env.EDITOR || ed; var args = editor.split(/\s+/); var bin = args.shift(); var ps = spawn(bin, args.concat([ file ]), { stdio: 'inherit' }); ps.on('exit', function (code, sig) { if (typeof cb === 'function') cb(code, sig) }); }; node-editor-1.0.0/package.json000066400000000000000000000014351251525557400162250ustar00rootroot00000000000000{ "name" : "editor", "version" : "1.0.0", "description" : "launch $EDITOR in your program", "main" : "index.js", "directories" : { "example" : "example", "test" : "test" }, "dependencies" : {}, "devDependencies" : { "tap" : "~0.4.4" }, "scripts" : { "test" : "tap test/*.js" }, "repository" : { "type" : "git", "url" : "git://github.com/substack/node-editor.git" }, "homepage" : "https://github.com/substack/node-editor", "keywords" : [ "text", "edit", "shell" ], "author" : { "name" : "James Halliday", "email" : "mail@substack.net", "url" : "http://substack.net" }, "license" : "MIT", "engine" : { "node" : ">=0.6" } }