/* webfan (C) Till Wehowski, Webfan.de - All rights reserved. */
'use strict';
var frdl = require('frdl');
var util = require('util');
var util_opts = {
showHidden : true,
depth : 4
};
var shellname = false;
var __shell = {
url : false
};
var _change = false;
exports.finalize = function(CLI){
if(!shellname || __shell.url) {
CLI.emit('catch', 'No shellname or no shell-url specified!');
}else{
var o = {
};
o[shellname]=__shell;
CLI.shells = $.extend(CLI.shells, o);
sessionStorage.setItem('webfan/cli $ shells', CLI.shells);
if(!!_change){
CLI.shell=shellname;
sessionStorage.setItem('webfan/cli $ shell', shellname);
}
}
CLI.data.data = CLI.messageLog;
CLI.emit('cmd.finalized', CLI.data.data);
};
exports.prepare = function(CLI){
CLI.finalState.add('cmd.finalized');
CLI.once('catch', function(err){
CLI.finalState.cancel();
if(frdl.alert)frdl.alert.error(err, false, 0);
});
CLI.addToken('addshell', '*', function(c, result_length, token, current_option){
shellname = '$ ' + token;
})
.addOption('change', 'Change to the new defined shell', function(name, value) {
_change = true;
}, ' [TEXT]', '-c')
.addOption('url', 'Specify the shell url (require-url format enabled)', function(name, value) {
__shell.url = value;
}, ' [TEXT]')
;
};
|