File: commands/webfan/addshell.js

Recommend this page to a friend!
  Classes of Till Wehowski  >  Widget CLI  >  commands/webfan/addshell.js  >  Download  
File: commands/webfan/addshell.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Widget CLI
Process commands entered by the user
Author: By
Last change:
Date: 5 years ago
Size: 1,615 bytes
 

Contents

Class file image Download
/* 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]') ; };