ramda-cli
Version:
A command-line tool for processing JSON with Ramda and LiveScript
29 lines (28 loc) • 915 B
JavaScript
// Generated by LiveScript 1.6.0
(function(){
var Path, isThere, HOME, BASE_PATH, getExistingConfigFile, edit, out$ = typeof exports != 'undefined' && exports || this;
Path = require('path');
isThere = require('is-there');
HOME = require('./utils').HOME;
out$.BASE_PATH = BASE_PATH = Path.join(HOME, '.config', 'ramda-cli');
out$.getExistingConfigFile = getExistingConfigFile = function(){
var exts, i$, len$, ext, p;
exts = ['.js', '.ls'];
for (i$ = 0, len$ = exts.length; i$ < len$; ++i$) {
ext = exts[i$];
p = BASE_PATH + ext;
if (isThere(p)) {
return p;
}
}
};
out$.edit = edit = function(cb){
var editor, that;
editor = require('editor');
if (that = getExistingConfigFile()) {
return editor(that, cb);
} else {
return cb(new Error("No config file, create one at " + BASE_PATH + ".{js,ls}"));
}
};
}).call(this);