mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
28 lines
613 B
JavaScript
28 lines
613 B
JavaScript
'use strict';
|
|
|
|
var exit = require('./exit');
|
|
|
|
module.exports.root = root;
|
|
module.exports.editor = editor;
|
|
|
|
function root(dir, fn) {
|
|
var fs;
|
|
|
|
if (dir !== '/') {
|
|
fs = require('fs');
|
|
fs.stat(dir, function(error) {
|
|
if (error)
|
|
exit('cloudcmd --root: %s', error.message);
|
|
else if (typeof fn === 'function')
|
|
fn('root:', dir);
|
|
});
|
|
}
|
|
}
|
|
|
|
function editor(name) {
|
|
var reg = /^(dword|edward|deepword)$/;
|
|
|
|
if (!reg.test(name))
|
|
exit('cloudcmd --editor: could be "dword", "edward" or "deepword" only');
|
|
}
|
|
|