mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
feature(beautify) "Supported file types" -> "File type not supported"
This commit is contained in:
parent
ad33e2410e
commit
50cbedd9f7
1 changed files with 8 additions and 4 deletions
|
|
@ -13,6 +13,9 @@
|
|||
HOME_UNIX = process.env.HOME,
|
||||
HOME = (HOME_UNIX || HOME_WIN) + '/',
|
||||
|
||||
EXT = ['js', 'css', 'html'],
|
||||
ERROR_MSG = 'File type "{{ ext }}" not supported.',
|
||||
ERROR_MSG_INST = 'Beautify not installed',
|
||||
ConfigPath = DIR + 'json/beautify.json',
|
||||
ConfigHome = HOME + '.beautify.json',
|
||||
|
||||
|
|
@ -21,17 +24,18 @@
|
|||
tryRequire(ConfigPath, {log: true}) || {};
|
||||
|
||||
module.exports = function(name, callback) {
|
||||
var EXT = ['js', 'css', 'html'],
|
||||
ext = path
|
||||
var ext = path
|
||||
.extname(name)
|
||||
.slice(1),
|
||||
|
||||
is = ~EXT.indexOf(ext);
|
||||
|
||||
if (!beautify)
|
||||
callback(Error('Beautify not installed'));
|
||||
callback(Error(ERROR_MSG_INST));
|
||||
else if (!is)
|
||||
callback(Error('Supported file types: ' + EXT.join(', ')));
|
||||
callback(Error(Util.render(ERROR_MSG, {
|
||||
ext : ext
|
||||
})));
|
||||
else
|
||||
fs.readFile(name, 'utf8', function(error, data) {
|
||||
var result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue