diff --git a/dist/index.d.ts b/dist/index.d.ts index 0f1d793..43d2399 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,10 +1,2 @@ -import * as SmartcliChecks from "./smartcli.checks"; -import * as SmartcliGetters from "./smartcli.getters"; -import * as SmartcliInteractions from "./smartcli.interaction"; -export declare let commander: any; -export declare let inquirer: any; -export declare let cliff: any; -export declare let argv: any; -export declare let check: typeof SmartcliChecks; -export declare let get: typeof SmartcliGetters; -export declare let interaction: typeof SmartcliInteractions; +import "typings-global"; +export { Smartcli } from "./smartcli.classes.smartcli"; diff --git a/dist/index.js b/dist/index.js index c3cf097..b6135af 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,27 +1,6 @@ -/// "use strict"; -var plugins = require("./smartcli.plugins"); -var SmartcliChecks = require("./smartcli.checks"); -var SmartcliGetters = require("./smartcli.getters"); -var SmartcliInteractions = require("./smartcli.interaction"); -/* ------------------------------------------------ * - * ---------- plugins for direct use -------------- * - * ------------------------------------------------ */ -exports.commander = plugins.commander; //commander allows cool chaining of cli actions -exports.inquirer = plugins.inquirer; //inquirer is for asking questions -exports.cliff = plugins.cliff; // formats cli output -exports.argv = plugins.argv; //argv gets initial cli commands and options. -/* ------------------------------------------------ * - * ---------- checks ------------------------------ * - * ------------------------------------------------ */ -exports.check = SmartcliChecks; -/* ------------------------------------------------ * - * ---------- getters ----------------------------- * - * ------------------------------------------------ */ -exports.get = SmartcliGetters; -/* ------------------------------------------------ * - * ---------- interaction ----------------------------- * - * ------------------------------------------------ */ -exports.interaction = SmartcliInteractions; +require("typings-global"); +var smartcli_classes_smartcli_1 = require("./smartcli.classes.smartcli"); +exports.Smartcli = smartcli_classes_smartcli_1.Smartcli; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDJDQUEyQzs7QUFHM0MsSUFBWSxPQUFPLFdB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LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKlxyXG4gKiAtLS0tLS0tLS0tIGdldHRlcnMgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKlxyXG4gKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi9cclxuZXhwb3J0IGxldCBnZXQgPSBTbWFydGNsaUdldHRlcnM7XHJcblxyXG4vKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKlxyXG4gKiAtLS0tLS0tLS0tIGludGVyYWN0aW9uIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tICpcclxuICogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tICovXHJcbmV4cG9ydCBsZXQgaW50ZXJhY3Rpb24gPSBTbWFydGNsaUludGVyYWN0aW9ucztcclxuIl19 +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFHeEIsMENBQXVCLDZCQUE2QixDQUFDO0FBQTdDLHdEQUE2QyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5cbmltcG9ydCB7U21hcnRjbGl9IGZyb20gXCIuL3NtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGlcIjtcbmV4cG9ydCB7U21hcnRjbGl9IGZyb20gXCIuL3NtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGlcIjtcbiJdfQ== diff --git a/dist/smartcli.checks.d.ts b/dist/smartcli.checks.d.ts index 8d2b383..6ae1f9a 100644 --- a/dist/smartcli.checks.d.ts +++ b/dist/smartcli.checks.d.ts @@ -1,15 +1,5 @@ +import "typings-global"; import "./smartcli.interfaces"; -/** - * checks for a special command string and returns true if found. - * @param commandString - * @returns {boolean} - */ -export declare let command: (commandString: string) => boolean; -/** - * checks if a command is present, returns true if yes, false if no. - * @returns {boolean} - */ -export declare let commandPresence: () => boolean; /** * checks for an special command argument at a certain position, returns true if matches, returns false if not * @param level diff --git a/dist/smartcli.checks.js b/dist/smartcli.checks.js index 23de24d..62a0c4d 100644 --- a/dist/smartcli.checks.js +++ b/dist/smartcli.checks.js @@ -1,28 +1,7 @@ -/// "use strict"; +require("typings-global"); require("./smartcli.interfaces"); var plugins = require("./smartcli.plugins"); -/** - * checks for a special command string and returns true if found. - * @param commandString - * @returns {boolean} - */ -exports.command = function (commandString) { - if (plugins.argv._.indexOf(commandString) == 0) { - return true; - } - return false; -}; -/** - * checks if a command is present, returns true if yes, false if no. - * @returns {boolean} - */ -exports.commandPresence = function () { - if (plugins.argv._.length > 0) { - return true; - } - return false; -}; /** * checks for an special command argument at a certain position, returns true if matches, returns false if not * @param level @@ -59,4 +38,4 @@ exports.optionPresence = function () { return false; }; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmNoZWNrcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7O0FBRTNDLFFBQU8sdUJBQXVCLENBQUMsQ0FBQTtBQUMvQixJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBRS9DOzs7O0dBSUc7QUFDUSxlQUFPLEdBQUcsVUFBUyxhQUFvQjtJQUM5QyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQ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ldHVybiB0cnVlO1xuICAgIH1cbiAgICByZXR1cm4gZmFsc2U7XG59O1xuXG4vKipcbiAqIGNoZWNrcyBmb3IgYSBzcGVjaWZpYyBvcHRpb24gc3RyaW5nLCByZXR1cm5zIHRydWUgaWYgeWVzLCByZXR1cm5zIGZhbHNlIGlmIG5vXG4gKiBAcmV0dXJucyB7Ym9vbGVhbn1cbiAqL1xuZXhwb3J0IGxldCBvcHRpb24gPSBmdW5jdGlvbihvcHRpb25TdHJpbmcpOmJvb2xlYW4ge1xuICAgIGlmKHBsdWdpbnMuc21hcnRwYXJhbS5leGlzdHMocGx1Z2lucy5hcmd2LCBvcHRpb25TdHJpbmcpKSB7XG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgIH1cbiAgICByZXR1cm4gZmFsc2U7XG59O1xuXG5leHBvcnQgbGV0IG9wdGlvblByZXNlbmNlID0gZnVuY3Rpb24oKTpib29sZWFuIHtcbiAgICBpZiAocGx1Z2lucy5hcmd2LmluZGV4T2YoKSAhPSAtMSkge1xuICAgICAgICByZXR1cm4gdHJ1ZVxuICAgIH1cbiAgICByZXR1cm4gZmFsc2U7XG59OyJdfQ== diff --git a/dist/smartcli.classes.d.ts b/dist/smartcli.classes.d.ts deleted file mode 100644 index 3508d1d..0000000 --- a/dist/smartcli.classes.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare class smartcli { - constructor(); -} diff --git a/dist/smartcli.classes.js b/dist/smartcli.classes.js deleted file mode 100644 index 0497a8c..0000000 --- a/dist/smartcli.classes.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -var smartcli = (function () { - function smartcli() { - } - return smartcli; -}()); -exports.smartcli = smartcli; - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmNsYXNzZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0lBRUk7SUFFQSxDQUFDO0lBQ0wsZUFBQztBQUFELENBTEEsQUFLQyxJQUFBO0FBTFksZ0JBQVEsV0FLcEIsQ0FBQSIsImZpbGUiOiJzbWFydGNsaS5jbGFzc2VzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNsYXNzIHNtYXJ0Y2xpIHtcclxuICAgIFxyXG4gICAgY29uc3RydWN0b3IoKXtcclxuICAgICAgICBcclxuICAgIH1cclxufSJdfQ== diff --git a/dist/smartcli.classes.smartcli.d.ts b/dist/smartcli.classes.smartcli.d.ts index 52b0436..cb1a202 100644 --- a/dist/smartcli.classes.smartcli.d.ts +++ b/dist/smartcli.classes.smartcli.d.ts @@ -1,2 +1,17 @@ -export declare class smartcli { +import "typings-global"; +import * as interfaces from "./smartcli.interfaces"; +export declare class Smartcli { + questionsDone: any; + commands: interfaces.CliCommand[]; + questions: any; + constructor(); + addCommand(definitionArg: { + commandName: string; + }): any; + addQuestion(definitionArg: { + questionString: string; + questionType: string; + }): void; + addVersion(versionArg: string): void; + startParse(): void; } diff --git a/dist/smartcli.classes.smartcli.js b/dist/smartcli.classes.smartcli.js index 743310b..a650a91 100644 --- a/dist/smartcli.classes.smartcli.js +++ b/dist/smartcli.classes.smartcli.js @@ -1,9 +1,30 @@ "use strict"; -var smartcli = (function () { - function smartcli() { +require("typings-global"); +var plugins = require("./smartcli.plugins"); +var Smartcli = (function () { + function Smartcli() { + this.questionsDone = plugins.q.defer(); } - return smartcli; + Smartcli.prototype.addCommand = function (definitionArg) { + var done = plugins.q.defer(); + if (plugins.argv._.indexOf(definitionArg.commandName) == 0) { + done.resolve(); + } + else { + return done.reject(); + } + return done.promsise; + }; + ; + Smartcli.prototype.addQuestion = function (definitionArg) { + }; + ; + Smartcli.prototype.addVersion = function (versionArg) { + }; + Smartcli.prototype.startParse = function () { + }; + return Smartcli; }()); -exports.smartcli = smartcli; +exports.Smartcli = Smartcli; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN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hbWU6c3RyaW5nfSl7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGlmIChwbHVnaW5zLmFyZ3YuXy5pbmRleE9mKGRlZmluaXRpb25BcmcuY29tbWFuZE5hbWUpID09IDApIHtcbiAgICAgICAgICAgIGRvbmUucmVzb2x2ZSgpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIGRvbmUucmVqZWN0KCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbXNpc2U7XG4gICAgfTtcbiAgICBhZGRRdWVzdGlvbihkZWZpbml0aW9uQXJnOntxdWVzdGlvblN0cmluZzpzdHJpbmcscXVlc3Rpb25UeXBlOnN0cmluZ30pe1xuICAgICAgICBcbiAgICB9O1xuICAgIGFkZFZlcnNpb24odmVyc2lvbkFyZzpzdHJpbmcpe1xuXG4gICAgfVxuICAgIHN0YXJ0UGFyc2UoKXtcblxuICAgIH1cblxufSJdfQ== diff --git a/dist/smartcli.getters.d.ts b/dist/smartcli.getters.d.ts index 4d6da6d..5806eaf 100644 --- a/dist/smartcli.getters.d.ts +++ b/dist/smartcli.getters.d.ts @@ -1,10 +1,5 @@ +import "typings-global"; import * as interfaces from "./smartcli.interfaces"; -/** - * - * @param commandString - * @returns {{specified: boolean, name: any, arguments: CliCommandArgument}} - */ -export declare let command: () => interfaces.CliCommand; /** * gets the second or higher value of plugins.argv._ if specified and returns it as commandArgument * @param argumentLevel diff --git a/dist/smartcli.getters.js b/dist/smartcli.getters.js index 3da924b..c2dd70a 100644 --- a/dist/smartcli.getters.js +++ b/dist/smartcli.getters.js @@ -1,20 +1,7 @@ -/// "use strict"; +require("typings-global"); var plugins = require("./smartcli.plugins"); var SmartcliChecks = require("./smartcli.checks"); -/** - * - * @param commandString - * @returns {{specified: boolean, name: any, arguments: CliCommandArgument}} - */ -exports.command = function () { - var cliCommand = { - specified: SmartcliChecks.commandPresence(), - name: plugins.argv._[0], - arguments: exports.commandArgs() - }; - return cliCommand; -}; /** * gets the second or higher value of plugins.argv._ if specified and returns it as commandArgument * @param argumentLevel @@ -99,4 +86,4 @@ exports.cwd = function () { }; }; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmdldHRlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMkNBQTJDOztBQUczQyxJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBQy9DLElBQU8sY0FBYyxXQUFXLG1CQUFtQixDQUFDLENBQUM7QUFFckQ7Ozs7R0FJRztBQUNRLGVBQU8sR0FBRztJQUNqQixJQUFJLFVBQVUsR0FBRztRQUNiLFNBQVMsRUFBRSxjQUFjLENBQUMsZUFBZSxFQUFFO1FBQzNDLElBQUksRUFBRSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDdkIsU0FBUyxFQUFFLG1CQUFXLEVBQUU7S0FDM0IsQ0FBQTtJQUNELE1BQU0sQ0FBQyxVQUFVLENBQUM7QUFDdEIsQ0FBQyxDQUFDO0FBRUY7Ozs7R0FJRztBQUNRLHVCQUFlLEdBQUcsVUFBUyxhQUFhO0lBQy9DLElBQUksZUFBZSxHQUFpQztRQUNoRCxTQUFTLEVBQUUsS0FBSztRQUNoQixJQUFJLEVBQUUsV0FBVztRQUNqQixLQUFLLEVBQUMsYUFBYTtLQUN0QixDQUFDO0lBQ0YsRUFBRSxDQUFBLENBQUMsYUFBYSxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDbkIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsOEVBQThFLENBQUMsQ0FBQztRQUN4RyxNQUFNLENBQUMsZUFBZSxDQUFDO0lBQzNCLENBQUM7SUFDRCxFQUFFLENBQUEsQ0FBQyxjQUFjLENBQUMsdUJBQ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yZWN0b3J5IG9mIGN3ZFxuICogQHJldHVybnMge3twYXRoOiBzdHJpbmd9fVxuICovXG5leHBvcnQgbGV0IGN3ZCA9IGZ1bmN0aW9uKCk6aW50ZXJmYWNlcy5EaXJlY3Rvcnkge1xuICAgIHJldHVybiB7XG4gICAgICAgIHBhdGg6IHByb2Nlc3MuY3dkKClcbiAgICB9XG59OyJdfQ== diff --git a/dist/smartcli.interaction.d.ts b/dist/smartcli.interaction.d.ts index 87d35b7..38d2047 100644 --- a/dist/smartcli.interaction.d.ts +++ b/dist/smartcli.interaction.d.ts @@ -1,3 +1,4 @@ +import "typings-global"; import "./smartcli.interfaces"; /** * executes callback with answer to question as argument diff --git a/dist/smartcli.interaction.js b/dist/smartcli.interaction.js index 62631d9..7780566 100644 --- a/dist/smartcli.interaction.js +++ b/dist/smartcli.interaction.js @@ -1,5 +1,5 @@ -/// "use strict"; +require("typings-global"); require("./smartcli.interfaces"); var plugins = require("./smartcli.plugins"); /** @@ -52,4 +52,4 @@ exports.getChoice = function (questionString, choiceOptions, cb) { }); }; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmludGVyYWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDJDQUEyQzs7QUFFM0MsUUFBTyx1QkFBdUIsQ0FBQyxDQUFBO0FBQy9CLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFL0M7Ozs7O0dBS0c7QUFDUSxpQkFBUyxHQUFHLFVBQVMsY0FBcUIsRUFBRSxFQUFFO0lBQ3JELEVBQUUsQ0FBQyxDQUFDLE9BQU8sY0FBYyxJQUFJLFFBQVEsQ0FBQyxDQUFDLENBQUM7UUFDcEMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsdUJBQXVCLENBQUMsQ0FBQztRQUNqRCxNQUFNLENBQUMsSUFBSSxDQUFDO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txdWVzdGlvbl0sZnVuY3Rpb24oYW5zd2Vycyl7XG4gICAgICAgIGxldCBhbnN3ZXIgPSBhbnN3ZXJzLnVzZXJGZWVkYmFjaztcbiAgICAgICAgY2IoYW5zd2VyKTtcbiAgICB9KTtcbn07XG5cbi8qKlxuICpcbiAqIEBwYXJhbSBxdWVzdGlvblN0cmluZ1xuICogQHBhcmFtIGNob2ljZU9wdGlvbnNcbiAqIEBwYXJhbSBjYlxuICogQHJldHVybnMge251bGx9XG4gKi9cbmV4cG9ydCBsZXQgZ2V0Q2hvaWNlID0gZnVuY3Rpb24ocXVlc3Rpb25TdHJpbmc6c3RyaW5nLCBjaG9pY2VPcHRpb25zOnN0cmluZ1tdLCBjYikge1xuICAgIGlmKCFBcnJheS5pc0FycmF5KGNob2ljZU9wdGlvbnMpKSB7XG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIC8vbWFrZSBpbnF1aXJlciBjb21wYXRpYmxlIHF1ZXN0aW9uIG9iamVjdFxuICAgIGxldCBxdWVzdGlvbiA9IHtcbiAgICAgICAgdHlwZTogXCJsaXN0XCIsXG4gICAgICAgIG5hbWU6IFwidXNlckZlZWRiYWNrXCIsXG4gICAgICAgIG1lc3NhZ2U6IHF1ZXN0aW9uU3RyaW5nLFxuICAgICAgICBjaG9pY2VzOiBjaG9pY2VPcHRpb25zLFxuICAgICAgICBmaWx0ZXI6IGZ1bmN0aW9uKCB2YWwgKSB7IHJldHVybiB2YWwudG9Mb3dlckNhc2UoKTsgfVxuICAgIH07XG5cbiAgICBwbHVnaW5zLmlucXVpcmVyLnByb21wdChxdWVzdGlvbixmdW5jdGlvbihhbnN3ZXJzKXtcbiAgICAgICAgbGV0IGFuc3dlciA9IGFuc3dlcnMudXNlckZlZWRiYWNrO1xuICAgICAgICBjYihhbnN3ZXIpO1xuICAgIH0pO1xuXG59OyJdfQ== diff --git a/dist/smartcli.interfaces.d.ts b/dist/smartcli.interfaces.d.ts index 7e826e6..119fe29 100644 --- a/dist/smartcli.interfaces.d.ts +++ b/dist/smartcli.interfaces.d.ts @@ -1,3 +1,9 @@ +import "typings-global"; +export interface CliCommand { + specified: boolean; + name: string; + arguments: CliCommandArgument[]; +} export interface CliOption { name: string; specified: boolean; @@ -6,11 +12,6 @@ export interface CliOption { export interface Directory { path: string; } -export interface CliCommand { - specified: boolean; - name: string; - arguments: CliCommandArgument[]; -} export interface CliCommandArgument { specified: boolean; name: string; diff --git a/dist/smartcli.interfaces.js b/dist/smartcli.interfaces.js index 74c0d21..3e0f144 100644 --- a/dist/smartcli.interfaces.js +++ b/dist/smartcli.interfaces.js @@ -1,3 +1,4 @@ "use strict"; +require("typings-global"); -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzbWFydGNsaS5pbnRlcmZhY2VzLmpzIiwic291cmNlc0NvbnRlbnQiOltdfQ== +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmludGVyZmFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQSIsImZpbGUiOiJzbWFydGNsaS5pbnRlcmZhY2VzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcblxuZXhwb3J0IGludGVyZmFjZSBDbGlDb21tYW5kIHtcbiAgICBzcGVjaWZpZWQ6IGJvb2xlYW47XG4gICAgbmFtZTogc3RyaW5nO1xuICAgIGFyZ3VtZW50czpDbGlDb21tYW5kQXJndW1lbnRbXTtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBDbGlPcHRpb24ge1xuICAgIG5hbWU6IHN0cmluZztcbiAgICBzcGVjaWZpZWQ6Ym9vbGVhbjtcbiAgICB2YWx1ZTogYW55O1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIERpcmVjdG9yeSB7XG4gICAgcGF0aDogc3RyaW5nO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIENsaUNvbW1hbmRBcmd1bWVudCB7XG4gICAgc3BlY2lmaWVkOmJvb2xlYW47XG4gICAgbmFtZTpzdHJpbmc7XG4gICAgbGV2ZWw6bnVtYmVyO1xufSJdfQ== diff --git a/dist/smartcli.plugins.d.ts b/dist/smartcli.plugins.d.ts index c88a82b..b3193e8 100644 --- a/dist/smartcli.plugins.d.ts +++ b/dist/smartcli.plugins.d.ts @@ -1,7 +1,8 @@ -export declare let path: any; +import "typings-global"; +export declare let argv: any; export declare let beautylog: any; export declare let cliff: any; -export declare let commander: any; export declare let inquirer: any; +export declare let path: any; +export declare let q: any; export declare let smartparam: any; -export declare let argv: any; diff --git a/dist/smartcli.plugins.js b/dist/smartcli.plugins.js index de48adc..5411738 100644 --- a/dist/smartcli.plugins.js +++ b/dist/smartcli.plugins.js @@ -1,11 +1,11 @@ -/// "use strict"; -exports.path = require("path"); +require("typings-global"); +exports.argv = require('yargs').argv; exports.beautylog = require("beautylog"); exports.cliff = require("cliff"); -exports.commander = require("commander"); exports.inquirer = require("inquirer"); +exports.path = require("path"); +exports.q = require("q"); exports.smartparam = require("smartparam"); -exports.argv = require('yargs').argv; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMkNBQTJDOztBQUVoQyxZQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ3ZCLGlCQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLGFBQUssR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7QUFDekIsaUJBQVMsR0FBRyxPQUFPLEN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DLGFBQUssR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7QUFDekIsZ0JBQVEsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUM7QUFDL0IsWUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN2QixTQUFDLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ2pCLGtCQUFVLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDIiwiZmlsZSI6InNtYXJ0Y2xpLnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiO1xuXG5leHBvcnQgbGV0IGFyZ3YgPSByZXF1aXJlKCd5YXJncycpLmFyZ3Y7XG5leHBvcnQgbGV0IGJlYXV0eWxvZyA9IHJlcXVpcmUoXCJiZWF1dHlsb2dcIik7XG5leHBvcnQgbGV0IGNsaWZmID0gcmVxdWlyZShcImNsaWZmXCIpO1xuZXhwb3J0IGxldCBpbnF1aXJlciA9IHJlcXVpcmUoXCJpbnF1aXJlclwiKTtcbmV4cG9ydCBsZXQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpO1xuZXhwb3J0IGxldCBxID0gcmVxdWlyZShcInFcIik7XG5leHBvcnQgbGV0IHNtYXJ0cGFyYW0gPSByZXF1aXJlKFwic21hcnRwYXJhbVwiKTsiXX0= diff --git a/package.json b/package.json index 2cef7f4..d6b6dda 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ "dependencies": { "beautylog": "^5.0.8", "cliff": "^0.1.10", - "commander": "^2.9.0", "inquirer": "^1.0.3", + "q": "^1.4.1", "smartparam": "0.0.7", "typings-global": "^1.0.3", "yargs": "^4.7.1" diff --git a/test/test.d.ts b/test/test.d.ts index 9ef6852..e7cc8ee 100644 --- a/test/test.d.ts +++ b/test/test.d.ts @@ -1,14 +1 @@ -/// -declare let smartcli: any; -declare let beautylog: any; -declare let should: any; -declare var checkCommandArgumentTest: () => void; -declare var checkCommandArgumentPresenceTest: () => void; -declare var getCommandTest: () => void; -declare var getCommandArgumentTest: () => void; -declare var getCommandArgsTest: () => void; -declare var getOptionTest: () => void; -declare var getCwdTest: () => void; -declare var interactionGetAnswerTest: () => void; -declare var interactionGetChoiceTest: () => void; -declare var endTests: () => void; +import "typings-test"; diff --git a/test/test.js b/test/test.js index a209b50..6c9da83 100644 --- a/test/test.js +++ b/test/test.js @@ -1,152 +1,7 @@ -/// +"use strict"; +require("typings-test"); var smartcli = require("../dist/index.js"); var beautylog = require("beautylog"); var should = require("should"); -/* ------------------------------------------------------------------ * - * ------------------- CHECKS TESTS --------------------------------- * - * ------------------------------------------------------------------ */ -describe("smartcli", function () { - describe(".check", function () { - describe(".command", function () { - it("should return true when specified command is found", function () { - smartcli.check.command("jazz").should.be.true(); - }); - it("should return false when specified command is NOT found", function () { - smartcli.check.command("rock").should.be.false(); - }); - }); - describe(".commandPresence", function () { - }); - }); -}); -var checkCommandArgumentTest = function () { - if (smartcli.check.commandArgument("jam", 1)) { - beautylog.success('There is a level 1 argument! Perfect!'); - } - else { - beautylog.error('There seems to be no level 1 argument... This is wrong'); - process.exit(1); - } - if (!smartcli.check.commandArgument("session", 2)) { - beautylog.success('There is no level 2 argument with the name of "session"! Perfect!'); - } - else { - beautylog.error('There seems to be a level 2 argument with the name of "session"! This is wrong'); - process.exit(1); - } -}; -checkCommandArgumentTest(); -var checkCommandArgumentPresenceTest = function () { - if (smartcli.check.commandArgumentPresence(1)) { - beautylog.success('There is a level 1 argument! Perfect!'); - } - else { - beautylog.error('There seems to be no level 1 argument... This is wrong'); - process.exit(1); - } - if (!smartcli.check.commandArgumentPresence(2)) { - beautylog.success('There is no level 2 argument! Perfect!'); - } - else { - beautylog.error('There seems to be a level 2 argument... This is wrong'); - process.exit(1); - } -}; -checkCommandArgumentPresenceTest(); -/* ------------------------------------------------------------------ * - * ------------------- GETTERS TESTS -------------------------------- * - * ------------------------------------------------------------------ */ -var getCommandTest = function () { - var cliCommand = smartcli.get.command(); - if (cliCommand.name == "jazz") { - beautylog.success('The specified command name is "jazz". Perfect!'); - } - else { - beautylog.error('The specified command name is not "jazz". Something is wrong!'); - process.exit(1); - } -}; -getCommandTest(); -var getCommandArgumentTest = function () { - var cliArgument = smartcli.get.commandArgument(1); - var cliArgument2 = smartcli.get.commandArgument(2); - if (cliArgument.name == "jam") { - beautylog.success('The first specified command argument name is "jam". Perfect!'); - } - else { - beautylog.error('The first specified command argument name is not "jam". Something is wrong!'); - process.exit(1); - } - if (cliArgument2.name == "undefined") { - beautylog.success('The second specified command argument name is "undefined". Perfect!'); - } - else { - beautylog.error('The second specified command argument name is not "undefined". Something is wrong!'); - process.exit(1); - } -}; -getCommandArgumentTest(); -var getCommandArgsTest = function () { - var commandArgs = smartcli.get.commandArgs(); - if (commandArgs[0].name == "jam") { - beautylog.success("first command argument is 'jam'. Perfect!"); - } - else { - beautylog.error("first command argument is not 'jam'. Something is wromg!"); - console.log(commandArgs[0].name); - process.exit(1); - } -}; -getCommandArgsTest(); -var getOptionTest = function () { - var cliOption = smartcli.get.option("awesome"); - var cliOption2 = smartcli.get.option("terrific"); - if (cliOption.specified) { - beautylog.success("awesome is specified. Perfect!"); - } - else { - beautylog.error("awesome is not specified. Somehthing is wrong"); - process.exit(1); - } - if (!cliOption2.specified) { - beautylog.success("terrific is not specified. Perfect!"); - } - else { - beautylog.error("terrific is specified. Somehthing is wrong"); - process.exit(1); - } -}; -getOptionTest(); -var getCwdTest = function () { - beautylog.info('The current directory is: ' + smartcli.get.cwd().path); -}; -getCwdTest(); -/* ------------------------------------------------------------------ * - * ------------------- INTERACTION TESTS ---------------------------- * - * ------------------------------------------------------------------ */ -var interactionGetAnswerTest = function () { - smartcli.interaction.getAnswer('How do you feel?', function (answer) { - console.log('The answer is: ' + answer); - interactionGetChoiceTest(); - }); -}; -var interactionGetChoiceTest = function () { - smartcli.interaction.getChoice('What music do you like to hear?', ['Jazz', 'Blues', 'Classical'], function (answer) { - console.log('The answer is: ' + answer); - endTests(); - }); -}; -var endTests = function () { - beautylog.ok("No more tests!"); - beautylog.success("Tests completed successfully!"); -}; -if (!smartcli.check.option("silent")) { - interactionGetAnswerTest(); -} -else { - beautylog.info("--silent option is specified, thus we are not running interaction tests."); - endTests(); -} -; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaURBQWlEO0FBQ2pELElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzNDLElBQUksU0FBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNyQyxJQUFJLE1BQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUM7QUFFL0I7O3dFQUV3RTtBQUV4RSxRQUFRLENBQUMsVUFBVSxFQUFDO0lBQ2hCLFFBQVEsQ0FBQyxRQUFRLEVBQUM7UUFDZCxRQUFRLENBQUMsVUFBVSxFQUFDO1lBQ2hCLEVBQUUsQ0FBQyxvREFBb0QsRUFBQztnQkFDcEQsUUFBUSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUNwRCxDQUFDLENBQUMsQ0FBQztZQUNILEVBQUUsQ0FBQyx5REFBeUQsRUFBQztnQkFDekQsUUFBUSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FBQztZQUNyRCxDQUFDLENBQUMsQ0FBQztRQUNQLENBQUMsQ0FBQyxDQUFDO1FBQ0gsUUFBUSxDQUFDLGtCQUFrQixFQUFDO1FBR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MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFFdEIsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBQUM7QUFDM0MsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ3JDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy10ZXN0XCI7XG5cbmxldCBzbWFydGNsaSA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xubGV0IGJlYXV0eWxvZyA9IHJlcXVpcmUoXCJiZWF1dHlsb2dcIik7XG5sZXQgc2hvdWxkID0gcmVxdWlyZShcInNob3VsZFwiKTtcblxuXG4iXX0= diff --git a/test/test.ts b/test/test.ts index 0d70be3..0c16521 100644 --- a/test/test.ts +++ b/test/test.ts @@ -4,163 +4,4 @@ let smartcli = require("../dist/index.js"); let beautylog = require("beautylog"); let should = require("should"); -/* ------------------------------------------------------------------ * - * ------------------- CHECKS TESTS --------------------------------- * - * ------------------------------------------------------------------ */ - -describe("smartcli",function(){ - describe(".check",function(){ - describe(".command",function(){ - it("should return true when specified command is found",function(){ - smartcli.check.command("jazz").should.be.true(); - }); - it("should return false when specified command is NOT found",function(){ - smartcli.check.command("rock").should.be.false(); - }); - }); - describe(".commandPresence",function(){ - - }); - }); -}); - - - - -var checkCommandArgumentTest = function() { - if (smartcli.check.commandArgument("jam",1)) { - beautylog.success('There is a level 1 argument! Perfect!'); - } else { - beautylog.error('There seems to be no level 1 argument... This is wrong'); - process.exit(1); - } - if (!smartcli.check.commandArgument("session",2)) { - beautylog.success('There is no level 2 argument with the name of "session"! Perfect!'); - } else { - beautylog.error('There seems to be a level 2 argument with the name of "session"! This is wrong'); - process.exit(1); - } -}; -checkCommandArgumentTest(); - -var checkCommandArgumentPresenceTest = function() { - if (smartcli.check.commandArgumentPresence(1)) { - beautylog.success('There is a level 1 argument! Perfect!'); - } else { - beautylog.error('There seems to be no level 1 argument... This is wrong'); - process.exit(1); - } - if (!smartcli.check.commandArgumentPresence(2)) { - beautylog.success('There is no level 2 argument! Perfect!'); - } else { - beautylog.error('There seems to be a level 2 argument... This is wrong'); - process.exit(1); - } -}; -checkCommandArgumentPresenceTest(); - -/* ------------------------------------------------------------------ * - * ------------------- GETTERS TESTS -------------------------------- * - * ------------------------------------------------------------------ */ -var getCommandTest = function(){ - var cliCommand = smartcli.get.command(); - if(cliCommand.name == "jazz") { - beautylog.success('The specified command name is "jazz". Perfect!'); - } else { - beautylog.error('The specified command name is not "jazz". Something is wrong!'); - process.exit(1); - } - -}; -getCommandTest(); - -var getCommandArgumentTest = function() { - var cliArgument = smartcli.get.commandArgument(1); - var cliArgument2 = smartcli.get.commandArgument(2); - if(cliArgument.name == "jam") { - beautylog.success('The first specified command argument name is "jam". Perfect!'); - } else { - beautylog.error('The first specified command argument name is not "jam". Something is wrong!'); - process.exit(1); - } - - if(cliArgument2.name == "undefined") { - beautylog.success('The second specified command argument name is "undefined". Perfect!'); - } else { - beautylog.error('The second specified command argument name is not "undefined". Something is wrong!'); - process.exit(1); - } -}; -getCommandArgumentTest(); - -var getCommandArgsTest = function() { - var commandArgs = smartcli.get.commandArgs(); - if(commandArgs[0].name == "jam") { - beautylog.success("first command argument is 'jam'. Perfect!"); - } else { - beautylog.error("first command argument is not 'jam'. Something is wromg!"); - console.log(commandArgs[0].name); - process.exit(1); - } -}; -getCommandArgsTest(); - -var getOptionTest = function() { - var cliOption = smartcli.get.option("awesome"); - var cliOption2 = smartcli.get.option("terrific"); - if(cliOption.specified){ - beautylog.success("awesome is specified. Perfect!") - } else { - beautylog.error("awesome is not specified. Somehthing is wrong"); - process.exit(1); - } - if(!cliOption2.specified){ - beautylog.success("terrific is not specified. Perfect!") - } else { - beautylog.error("terrific is specified. Somehthing is wrong"); - process.exit(1); - } -}; -getOptionTest(); - -var getCwdTest = function(){ - beautylog.info('The current directory is: ' + smartcli.get.cwd().path); -}; -getCwdTest(); - - -/* ------------------------------------------------------------------ * - * ------------------- INTERACTION TESTS ---------------------------- * - * ------------------------------------------------------------------ */ - - -var interactionGetAnswerTest = function() { - smartcli.interaction.getAnswer('How do you feel?',function(answer){ - console.log('The answer is: ' + answer); - interactionGetChoiceTest(); - }); -}; - - - -var interactionGetChoiceTest = function() { - smartcli.interaction.getChoice('What music do you like to hear?',['Jazz','Blues','Classical'],function(answer){ - console.log('The answer is: ' + answer); - endTests(); - }); -}; - -var endTests = function() { - beautylog.ok("No more tests!"); - beautylog.success("Tests completed successfully!"); -}; - -if(!smartcli.check.option("silent")){ - interactionGetAnswerTest(); -} else { - beautylog.info("--silent option is specified, thus we are not running interaction tests."); - endTests(); -}; - - diff --git a/ts/index.ts b/ts/index.ts index 6767796..351c05f 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,33 +1,4 @@ import "typings-global"; -import * as interfaces from "./smartcli.interfaces" -import * as plugins from "./smartcli.plugins" -import * as SmartcliChecks from "./smartcli.checks"; -import * as SmartcliGetters from "./smartcli.getters"; -import * as SmartcliInteractions from "./smartcli.interaction"; - import {Smartcli} from "./smartcli.classes.smartcli"; export {Smartcli} from "./smartcli.classes.smartcli"; - -/* ------------------------------------------------ * - * ---------- plugins for direct use -------------- * - * ------------------------------------------------ */ -export let commander = plugins.commander; //commander allows cool chaining of cli actions -export let inquirer = plugins.inquirer; //inquirer is for asking questions -export let cliff = plugins.cliff; // formats cli output -export let argv = plugins.argv; //argv gets initial cli commands and options. - -/* ------------------------------------------------ * - * ---------- checks ------------------------------ * - * ------------------------------------------------ */ -export let check = SmartcliChecks; - -/* ------------------------------------------------ * - * ---------- getters ----------------------------- * - * ------------------------------------------------ */ -export let get = SmartcliGetters; - -/* ------------------------------------------------ * - * ---------- interaction ----------------------------- * - * ------------------------------------------------ */ -export let interaction = SmartcliInteractions; diff --git a/ts/smartcli.checks.ts b/ts/smartcli.checks.ts index a605d3e..ac11cca 100644 --- a/ts/smartcli.checks.ts +++ b/ts/smartcli.checks.ts @@ -3,28 +3,6 @@ import "typings-global"; import "./smartcli.interfaces"; import plugins = require("./smartcli.plugins"); -/** - * checks for a special command string and returns true if found. - * @param commandString - * @returns {boolean} - */ -export let command = function(commandString:string):boolean { - if (plugins.argv._.indexOf(commandString) == 0) { - return true - } - return false; -}; - -/** - * checks if a command is present, returns true if yes, false if no. - * @returns {boolean} - */ -export let commandPresence = function():boolean { - if(plugins.argv._.length > 0){ - return true; - } - return false; -}; /** * checks for an special command argument at a certain position, returns true if matches, returns false if not diff --git a/ts/smartcli.classes.smartcli.ts b/ts/smartcli.classes.smartcli.ts index 0b518a1..dd38e1e 100644 --- a/ts/smartcli.classes.smartcli.ts +++ b/ts/smartcli.classes.smartcli.ts @@ -1,5 +1,35 @@ import "typings-global"; +import * as interfaces from "./smartcli.interfaces" +import * as plugins from "./smartcli.plugins" +import * as SmartcliChecks from "./smartcli.checks"; +import * as SmartcliGetters from "./smartcli.getters"; +import * as SmartcliInteractions from "./smartcli.interaction"; + export class Smartcli { - + questionsDone; + commands:interfaces.CliCommand[]; + questions; + constructor(){ + this.questionsDone = plugins.q.defer(); + } + addCommand(definitionArg:{commandName:string}){ + let done = plugins.q.defer(); + if (plugins.argv._.indexOf(definitionArg.commandName) == 0) { + done.resolve(); + } else { + return done.reject(); + } + return done.promsise; + }; + addQuestion(definitionArg:{questionString:string,questionType:string}){ + + }; + addVersion(versionArg:string){ + + } + startParse(){ + + } + } \ No newline at end of file diff --git a/ts/smartcli.getters.ts b/ts/smartcli.getters.ts index 0a67e84..1f2b3b5 100644 --- a/ts/smartcli.getters.ts +++ b/ts/smartcli.getters.ts @@ -4,19 +4,6 @@ import * as interfaces from "./smartcli.interfaces"; import plugins = require("./smartcli.plugins"); import SmartcliChecks = require("./smartcli.checks"); -/** - * - * @param commandString - * @returns {{specified: boolean, name: any, arguments: CliCommandArgument}} - */ -export let command = function():interfaces.CliCommand { - var cliCommand = { - specified: SmartcliChecks.commandPresence(), - name: plugins.argv._[0], - arguments: commandArgs() - } - return cliCommand; -}; /** * gets the second or higher value of plugins.argv._ if specified and returns it as commandArgument diff --git a/ts/smartcli.interaction.ts b/ts/smartcli.interaction.ts index 78f952d..8a41310 100644 --- a/ts/smartcli.interaction.ts +++ b/ts/smartcli.interaction.ts @@ -15,7 +15,7 @@ export let getAnswer = function(questionString:string, cb) { return null; } //make inquirer compatible question object - var question = { + let question = { type: "input", name: "userFeedback", message: questionString, @@ -25,7 +25,7 @@ export let getAnswer = function(questionString:string, cb) { }; plugins.inquirer.prompt([question],function(answers){ - var answer = answers.userFeedback; + let answer = answers.userFeedback; cb(answer); }); }; @@ -43,7 +43,7 @@ export let getChoice = function(questionString:string, choiceOptions:string[], c } //make inquirer compatible question object - var question = { + let question = { type: "list", name: "userFeedback", message: questionString, @@ -52,7 +52,7 @@ export let getChoice = function(questionString:string, choiceOptions:string[], c }; plugins.inquirer.prompt(question,function(answers){ - var answer = answers.userFeedback; + let answer = answers.userFeedback; cb(answer); }); diff --git a/ts/smartcli.interfaces.ts b/ts/smartcli.interfaces.ts index 9ec434a..35cda3c 100644 --- a/ts/smartcli.interfaces.ts +++ b/ts/smartcli.interfaces.ts @@ -1,5 +1,11 @@ import "typings-global"; +export interface CliCommand { + specified: boolean; + name: string; + arguments:CliCommandArgument[]; +} + export interface CliOption { name: string; specified:boolean; @@ -10,12 +16,6 @@ export interface Directory { path: string; } -export interface CliCommand { - specified: boolean; - name: string; - arguments:CliCommandArgument[]; -} - export interface CliCommandArgument { specified:boolean; name:string; diff --git a/ts/smartcli.plugins.ts b/ts/smartcli.plugins.ts index 49aae9f..3d4ffdb 100644 --- a/ts/smartcli.plugins.ts +++ b/ts/smartcli.plugins.ts @@ -1,9 +1,9 @@ import "typings-global"; -export let path = require("path"); +export let argv = require('yargs').argv; export let beautylog = require("beautylog"); export let cliff = require("cliff"); -export let commander = require("commander"); export let inquirer = require("inquirer"); -export let smartparam = require("smartparam"); -export let argv = require('yargs').argv; \ No newline at end of file +export let path = require("path"); +export let q = require("q"); +export let smartparam = require("smartparam"); \ No newline at end of file