mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-01 04:05:18 +00:00
feature(validate) mv console.log out
This commit is contained in:
parent
86e5f8dd49
commit
c18921a5c2
2 changed files with 10 additions and 3 deletions
|
|
@ -101,6 +101,8 @@ if (args.version) {
|
|||
if (args.password)
|
||||
config('password', getPassword(args.password));
|
||||
|
||||
validateRoot(options.root);
|
||||
|
||||
if (!args.save)
|
||||
start(options);
|
||||
else
|
||||
|
|
@ -109,6 +111,11 @@ if (args.version) {
|
|||
});
|
||||
}
|
||||
|
||||
function validateRoot(root) {
|
||||
var validate = require('../lib/server/validate');
|
||||
validate.root(root, console.log);
|
||||
}
|
||||
|
||||
function getPassword(password) {
|
||||
var criton = require('criton');
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ var exit = require('./exit');
|
|||
module.exports.root = root;
|
||||
module.exports.editor = editor;
|
||||
|
||||
function root(dir) {
|
||||
function root(dir, fn) {
|
||||
var fs;
|
||||
|
||||
if (dir !== '/') {
|
||||
|
|
@ -13,8 +13,8 @@ function root(dir) {
|
|||
fs.stat(dir, function(error) {
|
||||
if (error)
|
||||
exit('cloudcmd --root: %s', error.message);
|
||||
else
|
||||
console.log('root:', dir);
|
||||
else if (typeof fn === 'function')
|
||||
fn('root:', dir);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue