mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-27 17:54:11 +00:00
feature(edit) add beautify
This commit is contained in:
parent
7c6d963b6e
commit
3ee321bbce
5 changed files with 38 additions and 10 deletions
|
|
@ -8,23 +8,29 @@
|
|||
flop = require(DIR_SERVER + 'flop'),
|
||||
Hash = require(DIR_SERVER + 'hash'),
|
||||
mellow = require(DIR_SERVER + 'mellow'),
|
||||
beautify = require(DIR_SERVER + 'beautify'),
|
||||
Util = require(DIR + 'util');
|
||||
|
||||
module.exports = function(query, name, callback) {
|
||||
var hash, error,
|
||||
func = Util.exec.ret(callback);
|
||||
var hash, error;
|
||||
|
||||
Util.checkArgs(arguments, ['query', 'name', 'callback']);
|
||||
|
||||
switch (query) {
|
||||
default:
|
||||
mellow.read(name, func);
|
||||
mellow.read(name, callback);
|
||||
break;
|
||||
|
||||
case 'size':
|
||||
flop.read(name, 'size', func);
|
||||
flop.read(name, 'size', callback);
|
||||
break;
|
||||
|
||||
case 'time':
|
||||
flop.read(name, 'time', func);
|
||||
flop.read(name, 'time', callback);
|
||||
break;
|
||||
|
||||
case 'beautify':
|
||||
beautify(name, callback);
|
||||
break;
|
||||
|
||||
case 'hash':
|
||||
|
|
@ -32,7 +38,7 @@
|
|||
|
||||
if (!hash) {
|
||||
error = 'hash: not suported, try update node';
|
||||
func(new Error(error));
|
||||
callback(Error(error));
|
||||
} else
|
||||
pipe.create(name, hash, function (error) {
|
||||
var hex;
|
||||
|
|
@ -40,7 +46,7 @@
|
|||
if (!error)
|
||||
hex = hash.get();
|
||||
|
||||
func(error, hex);
|
||||
callback(error, hex);
|
||||
});
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue