From c115d222c0dea7ad33eb63c836c76d81a86302f5 Mon Sep 17 00:00:00 2001 From: philkunz Date: Fri, 26 Aug 2016 09:21:42 +0200 Subject: [PATCH] improve intellisense --- dist/index.js | 3 +- dist/smartcli.classes.command.d.ts | 3 - dist/smartcli.classes.command.js | 10 --- dist/smartcli.classes.interaction.helpers.js | 13 ++- dist/smartcli.classes.interaction.js | 10 +-- dist/smartcli.classes.smartcli.d.ts | 17 +++- dist/smartcli.classes.smartcli.js | 87 +++++++++++--------- dist/smartcli.interaction.d.ts | 0 dist/smartcli.interaction.js | 3 - dist/smartcli.plugins.d.ts | 7 +- dist/smartcli.plugins.js | 4 +- package.json | 16 ++-- test/test.js | 13 ++- ts/smartcli.classes.command.ts | 6 -- ts/smartcli.classes.smartcli.ts | 16 +++- ts/smartcli.interaction.ts | 0 ts/smartcli.plugins.ts | 7 +- 17 files changed, 113 insertions(+), 102 deletions(-) delete mode 100644 dist/smartcli.classes.command.d.ts delete mode 100644 dist/smartcli.classes.command.js delete mode 100644 dist/smartcli.interaction.d.ts delete mode 100644 dist/smartcli.interaction.js delete mode 100644 ts/smartcli.classes.command.ts delete mode 100644 ts/smartcli.interaction.ts diff --git a/dist/index.js b/dist/index.js index b6135af..8dc8ec3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2,5 +2,4 @@ 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFHeEIsMENBQXVCLDZCQUE2QixDQUFDO0FBQTdDLHdEQUE2QyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5cbmltcG9ydCB7U21hcnRjbGl9IGZyb20gXCIuL3NtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGlcIjtcbmV4cG9ydCB7U21hcnRjbGl9IGZyb20gXCIuL3NtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGlcIjtcbiJdfQ== +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBR3hCLDBDQUF1Qiw2QkFBNkIsQ0FBQztBQUE3Qyx3REFBNkMifQ== \ No newline at end of file diff --git a/dist/smartcli.classes.command.d.ts b/dist/smartcli.classes.command.d.ts deleted file mode 100644 index 8e96183..0000000 --- a/dist/smartcli.classes.command.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import "typings-global"; -export declare class Command { -} diff --git a/dist/smartcli.classes.command.js b/dist/smartcli.classes.command.js deleted file mode 100644 index 2fdeb6b..0000000 --- a/dist/smartcli.classes.command.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -require("typings-global"); -var Command = (function () { - function Command() { - } - return Command; -}()); -exports.Command = Command; - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmNsYXNzZXMuY29tbWFuZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBR3hCO0lBQUE7SUFFQSxDQUFDO0lBQUQsY0FBQztBQUFELENBRkEsQUFFQyxJQUFBO0FBRlksZUFBTyxVQUVuQixDQUFBIiwiZmlsZSI6InNtYXJ0Y2xpLmNsYXNzZXMuY29tbWFuZC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5pbXBvcnQgKiBhcyBwbHVnaW5zIGZyb20gXCIuL3NtYXJ0Y2xpLnBsdWdpbnNcIjtcblxuZXhwb3J0IGNsYXNzIENvbW1hbmQge1xuXG59Il19 diff --git a/dist/smartcli.classes.interaction.helpers.js b/dist/smartcli.classes.interaction.helpers.js index bcff64d..1182a18 100644 --- a/dist/smartcli.classes.interaction.helpers.js +++ b/dist/smartcli.classes.interaction.helpers.js @@ -1,7 +1,7 @@ "use strict"; require("typings-global"); require("./smartcli.interfaces"); -var plugins = require("./smartcli.plugins"); +const plugins = require("./smartcli.plugins"); /** * executes callback with answer to question as argument * @param questionString the question you want to ask the user @@ -14,7 +14,7 @@ exports.getAnswer = function (questionString, cb) { return null; } //make inquirer compatible question object - var question = { + let question = { type: "input", name: "userFeedback", message: questionString, @@ -23,7 +23,7 @@ exports.getAnswer = function (questionString, cb) { } }; plugins.inquirer.prompt([question], function (answers) { - var answer = answers.userFeedback; + let answer = answers.userFeedback; cb(answer); }); }; @@ -39,7 +39,7 @@ exports.getChoice = function (questionString, choiceOptions, cb) { return null; } //make inquirer compatible question object - var question = { + let question = { type: "list", name: "userFeedback", message: questionString, @@ -47,9 +47,8 @@ exports.getChoice = function (questionString, choiceOptions, cb) { filter: function (val) { return val.toLowerCase(); } }; plugins.inquirer.prompt(question, function (answers) { - var answer = answers.userFeedback; + let answer = answers.userFeedback; cb(answer); }); }; - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmNsYXNzZXMuaW50ZXJhY3Rpb24uaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLFFBQU8sdUJBQXVCLENBQUMsQ0FBQTtBQUMvQixJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBR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yxPQUFPLENBQUMsWUFBWSxDQUFDO1FBQ2xDLEVBQUUsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNmLENBQUMsQ0FBQyxDQUFDO0FBRVAsQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/dist/smartcli.classes.interaction.js b/dist/smartcli.classes.interaction.js index 6bdaea4..e601eef 100644 --- a/dist/smartcli.classes.interaction.js +++ b/dist/smartcli.classes.interaction.js @@ -1,10 +1,8 @@ "use strict"; require("typings-global"); -var Question = (function () { - function Question() { +class Question { + constructor() { } - return Question; -}()); +} exports.Question = Question; - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmNsYXNzZXMuaW50ZXJhY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUd4QjtJQUNJO0lBRUEsQ0FBQztJQUNMLGVBQUM7QUFBRCxDQUpBLEFBSUMsSUFBQTtBQUpZLGdCQUFRLFdBSXBCLENBQUEiLCJmaWxlIjoic21hcnRjbGkuY2xhc3Nlcy5pbnRlcmFjdGlvbi5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5pbXBvcnQgKiBhcyBwbHVnaW5zIGZyb20gXCIuL3NtYXJ0Y2xpLnBsdWdpbnNcIjtcblxuZXhwb3J0IGNsYXNzIFF1ZXN0aW9uIHtcbiAgICBjb25zdHJ1Y3Rvcigpe1xuICAgICAgICBcbiAgICB9XG59Il19 +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkuY2xhc3Nlcy5pbnRlcmFjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLmNsYXNzZXMuaW50ZXJhY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUd4QjtJQUNJO0lBRUEsQ0FBQztBQUNMLENBQUM7QUFKWSxnQkFBUSxXQUlwQixDQUFBIn0= \ No newline at end of file diff --git a/dist/smartcli.classes.smartcli.d.ts b/dist/smartcli.classes.smartcli.d.ts index 9b9d500..e95036a 100644 --- a/dist/smartcli.classes.smartcli.d.ts +++ b/dist/smartcli.classes.smartcli.d.ts @@ -1,4 +1,6 @@ +/// import "typings-global"; +import * as plugins from "./smartcli.plugins"; export declare class Smartcli { argv: any; questionsDone: any; @@ -7,10 +9,21 @@ export declare class Smartcli { questions: any; version: string; constructor(); + /** + * adds an alias, meaning one equals the other in terms of triggering associated commands + */ addAlias(keyArg: any, aliasArg: any): void; + /** + * adds a Command by returning a Promise that reacts to the specific commandString given. + * + * Note: in e.g. "npm install something" the "install" is considered the command. + */ addCommand(definitionArg: { commandName: string; - }): any; + }): plugins.q.Promise<{}>; + /** + * gets a Promise for a command word + */ getCommandPromise(commandNameArg: any): void; addQuestion(definitionArg: { questionString: string; @@ -18,6 +31,6 @@ export declare class Smartcli { }): void; addHelp(): void; addVersion(versionArg: string): void; - standardTask(): any; + standardTask(): plugins.q.Promise<{}>; startParse(): void; } diff --git a/dist/smartcli.classes.smartcli.js b/dist/smartcli.classes.smartcli.js index 6903d05..f03712e 100644 --- a/dist/smartcli.classes.smartcli.js +++ b/dist/smartcli.classes.smartcli.js @@ -1,71 +1,78 @@ "use strict"; require("typings-global"); -var plugins = require("./smartcli.plugins"); -var Smartcli = (function () { - function Smartcli() { +const plugins = require("./smartcli.plugins"); +class Smartcli { + constructor() { this.argv = plugins.argv; this.questionsDone = plugins.q.defer(); this.parseStarted = plugins.q.defer(); } - Smartcli.prototype.addAlias = function (keyArg, aliasArg) { - this.argv = this.argv.alias(keyArg, aliasArg); - }; ; - Smartcli.prototype.addCommand = function (definitionArg) { - var _this = this; - var done = plugins.q.defer(); + /** + * adds an alias, meaning one equals the other in terms of triggering associated commands + */ + addAlias(keyArg, aliasArg) { + this.argv = this.argv.alias(keyArg, aliasArg); + } + ; + /** + * adds a Command by returning a Promise that reacts to the specific commandString given. + * + * Note: in e.g. "npm install something" the "install" is considered the command. + */ + addCommand(definitionArg) { + let done = plugins.q.defer(); this.parseStarted.promise - .then(function () { - if (_this.argv._.indexOf(definitionArg.commandName) == 0) { - done.resolve(_this.argv); + .then(() => { + if (this.argv._.indexOf(definitionArg.commandName) == 0) { + done.resolve(this.argv); } else { - done.reject(_this.argv); + done.reject(this.argv); } }); return done.promise; - }; + } ; - Smartcli.prototype.getCommandPromise = function (commandNameArg) { + /** + * gets a Promise for a command word + */ + getCommandPromise(commandNameArg) { //TODO - }; - Smartcli.prototype.addQuestion = function (definitionArg) { - }; + } + addQuestion(definitionArg) { + } ; - Smartcli.prototype.addHelp = function () { - }; - Smartcli.prototype.addVersion = function (versionArg) { - var _this = this; + addHelp() { + } + addVersion(versionArg) { this.version = versionArg; this.addAlias("v", "version"); this.parseStarted.promise - .then(function () { - if (_this.argv.v) { - console.log(_this.version); + .then(() => { + if (this.argv.v) { + console.log(this.version); } }); - }; - Smartcli.prototype.standardTask = function () { - var _this = this; - var done = plugins.q.defer(); + } + standardTask() { + let done = plugins.q.defer(); this.parseStarted.promise - .then(function () { - if (_this.argv._.length == 0 && !_this.argv.v) { - done.resolve(_this.argv); + .then(() => { + if (this.argv._.length == 0 && !this.argv.v) { + done.resolve(this.argv); } else { - done.reject(_this.argv); + done.reject(this.argv); } ; }); return done.promise; - }; - Smartcli.prototype.startParse = function () { + } + startParse() { this.argv = this.argv.argv; this.parseStarted.resolve(); - }; - return Smartcli; -}()); + } +} exports.Smartcli = Smartcli; - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGkudHMiXSwibmFtZXMiOltdLCJtYX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0aGlzLmFkZEFsaWFzKFwidlwiLFwidmVyc2lvblwiKTtcbiAgICAgICAgdGhpcy5wYXJzZVN0YXJ0ZWQucHJvbWlzZVxuICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmKHRoaXMuYXJndi52KXtcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2codGhpcy52ZXJzaW9uKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KVxuICAgIH1cbiAgICBzdGFuZGFyZFRhc2soKXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgdGhpcy5wYXJzZVN0YXJ0ZWQucHJvbWlzZVxuICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgIGlmKHRoaXMuYXJndi5fLmxlbmd0aCA9PSAwICYmICF0aGlzLmFyZ3Yudil7XG4gICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZSh0aGlzLmFyZ3YpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGRvbmUucmVqZWN0KHRoaXMuYXJndik7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH1cbiAgICBzdGFydFBhcnNlKCl7XG4gICAgICAgIHRoaXMuYXJndiA9IHRoaXMuYXJndi5hcmd2O1xuICAgICAgICB0aGlzLnBhcnNlU3RhcnRlZC5yZXNvbHZlKCk7XG4gICAgfVxuXG59Il19 +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkuY2xhc3Nlcy5zbWFydGNsaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGkudHMiXSwibmFtZXMiO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QUM7Z0JBQ0osSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7WUFDM0IsQ0FBQztZQUFBLENBQUM7UUFDTixDQUFDLENBQUMsQ0FBQztRQUNQLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0lBQ3hCLENBQUM7SUFDRCxVQUFVO1FBQ04sSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQztRQUMzQixJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2hDLENBQUM7QUFFTCxDQUFDO0FBN0VZLGdCQUFRLFdBNkVwQixDQUFBIn0= \ No newline at end of file diff --git a/dist/smartcli.interaction.d.ts b/dist/smartcli.interaction.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/dist/smartcli.interaction.js b/dist/smartcli.interaction.js deleted file mode 100644 index 4d21df1..0000000 --- a/dist/smartcli.interaction.js +++ /dev/null @@ -1,3 +0,0 @@ - - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzbWFydGNsaS5pbnRlcmFjdGlvbi5qcyIsInNvdXJjZXNDb250ZW50IjpbXX0= diff --git a/dist/smartcli.plugins.d.ts b/dist/smartcli.plugins.d.ts index b3193e8..464069e 100644 --- a/dist/smartcli.plugins.d.ts +++ b/dist/smartcli.plugins.d.ts @@ -1,8 +1,9 @@ import "typings-global"; export declare let argv: any; -export declare let beautylog: any; +export import beautylog = require("beautylog"); export declare let cliff: any; export declare let inquirer: any; +export import lik = require("lik"); export declare let path: any; -export declare let q: any; -export declare let smartparam: any; +export import q = require("q"); +export import smartparam = require("smartparam"); diff --git a/dist/smartcli.plugins.js b/dist/smartcli.plugins.js index d0392a0..ec31025 100644 --- a/dist/smartcli.plugins.js +++ b/dist/smartcli.plugins.js @@ -4,8 +4,8 @@ exports.argv = require('yargs'); exports.beautylog = require("beautylog"); exports.cliff = require("cliff"); exports.inquirer = require("inquirer"); +exports.lik = require("lik"); exports.path = require("path"); exports.q = require("q"); exports.smartparam = require("smartparam"); - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUViLFlBQUksR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7QUFDeEIsaUJBQVMsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUM7QUFDakMsYUFBSyxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUN6QixnQkFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUMvQixZQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ3ZCLFNBQUMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDakIsa0JBQVUsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRjbGkucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5cbmV4cG9ydCBsZXQgYXJndiA9IHJlcXVpcmUoJ3lhcmdzJyk7XG5leHBvcnQgbGV0IGJlYXV0eWxvZyA9IHJlcXVpcmUoXCJiZWF1dHlsb2dcIik7XG5leHBvcnQgbGV0IGNsaWZmID0gcmVxdWlyZShcImNsaWZmXCIpO1xuZXhwb3J0IGxldCBpbnF1aXJlciA9IHJlcXVpcmUoXCJpbnF1aXJlclwiKTtcbmV4cG9ydCBsZXQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpO1xuZXhwb3J0IGxldCBxID0gcmVxdWlyZShcInFcIik7XG5leHBvcnQgbGV0IHNtYXJ0cGFyYW0gPSByZXF1aXJlKFwic21hcnRwYXJhbVwiKTsiXX0= +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUViLFlBQUksR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7QUFDckIsaUJBQVMsV0FBVyxXQUFXLENBQUMsQ0FBQztBQUNwQyxhQUFLLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQ3pCLGdCQUFRLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0FBQzVCLFdBQUcsV0FBVyxLQUFLLENBQUMsQ0FBQztBQUN4QixZQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ3BCLFNBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQztBQUNqQixrQkFBVSxXQUFXLFlBQVksQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/package.json b/package.json index 6aca6cc..6383352 100644 --- a/package.json +++ b/package.json @@ -28,17 +28,19 @@ }, "homepage": "https://gitlab.com/pushrocks/smartcli", "dependencies": { - "beautylog": "^5.0.12", + "@types/q": "0.0.30", + "beautylog": "^5.0.20", "cliff": "^0.1.10", - "inquirer": "^1.0.3", + "inquirer": "^1.1.2", + "lik": "^1.0.15", "q": "^1.4.1", - "smartparam": "0.0.7", - "typings-global": "^1.0.3", - "yargs": "^4.7.1" + "smartparam": "0.1.1", + "typings-global": "^1.0.6", + "yargs": "^5.0.0" }, "devDependencies": { - "npmts-g": "^5.2.6", - "should": "^9.0.2", + "npmts-g": "^5.2.8", + "should": "^11.1.0", "typings-test": "^1.0.1" } } diff --git a/test/test.js b/test/test.js index 0c07917..a16c936 100644 --- a/test/test.js +++ b/test/test.js @@ -1,10 +1,10 @@ "use strict"; require("typings-test"); -var smartcli = require("../dist/index"); -var beautylog = require("beautylog"); -var should = require("should"); +const smartcli = require("../dist/index"); +let beautylog = require("beautylog"); +let should = require("should"); describe("smartcli.Smartcli class", function () { - var smartCliTestObject; + let smartCliTestObject; describe("new Smartcli()", function () { it("should create a new Smartcli", function () { smartCliTestObject = new smartcli.Smartcli(); @@ -21,7 +21,7 @@ describe("smartcli.Smartcli class", function () { describe(".standardTask", function () { it("should start parsing a standardTask", function (done) { smartCliTestObject.standardTask() - .then(function () { + .then(() => { console.log("this is the standard Task!"); }); done(); @@ -33,5 +33,4 @@ describe("smartcli.Smartcli class", function () { }); }); }); - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFFdEIsSUFBTyxRQUFRLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDM0MsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ3JDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUUvQixRQUFRLENBQUMseUJBQXlCLEVBQUM7SUFDL0IsSUFBSSxrQkFBb0MsQ0FBQztJQUN6QyxRQUFRLENBQUMsZ0JBQWdCLEVBQUM7UUFDdEIsRUFBRSxDQUFDLDhCQUE4QixFQUFDO1lBQzlCLGtCQUFrQixHQUFHLElBQUksUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDO1lBQzdDLGtCQUFrQixDQUFDLE1BQU0sQ0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ztJQUNQLENBQUMsQ0FBQyxDQUFDO0lBQ0gsUUFBUSxDQUFDLGFBQWEsRUFBQztRQUNuQixFQUFFLENBQUMsdUJBQXVCLEVBQUM7WUFDdkIsa0JBQWtCLENBQUMsVUFBVSxDQUFDO2dCQUMxQixXQUFXLEVBQUMsU0FBUzthQUN4QixDQUFDLENBQUM7UUFFUCxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDO0lBQ0gsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMscUNBQXFDLEVBQUMsVUFBUyxJQUFJO1lBQ2xELGtCQUFrQixDQUFDLFlBQVksRUFBRTtpQkFDNUIsSUFBSSxDQUFDO2dCQUNGLE9BQU8sQ0FBQyxHQUFHLENBQUMsNEJBQTRCLENBQUMsQ0FBQztZQUM5QyxDQUFDLENBQUMsQ0FBQztZQUNQLElBQUksRUFBRSxDQUFDO1FBQ1gsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtJQUNGLFFBQVEsQ0FBQyxhQUFhLEVBQUM7UUFDbkIsRUFBRSxDQUFDLG9DQUFvQyxFQUFDO1lBQ3BDLGtCQUFrQixDQUFDLFVBQVUsRUFBRSxDQUFDO1FBQ3BDLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7QUFDTixDQUFDLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/ts/smartcli.classes.command.ts b/ts/smartcli.classes.command.ts deleted file mode 100644 index bce36dc..0000000 --- a/ts/smartcli.classes.command.ts +++ /dev/null @@ -1,6 +0,0 @@ -import "typings-global"; -import * as plugins from "./smartcli.plugins"; - -export class Command { - -} \ No newline at end of file diff --git a/ts/smartcli.classes.smartcli.ts b/ts/smartcli.classes.smartcli.ts index e19f131..d33a614 100644 --- a/ts/smartcli.classes.smartcli.ts +++ b/ts/smartcli.classes.smartcli.ts @@ -14,10 +14,20 @@ export class Smartcli { this.argv = plugins.argv; this.questionsDone = plugins.q.defer(); this.parseStarted = plugins.q.defer(); - } + }; + + /** + * adds an alias, meaning one equals the other in terms of triggering associated commands + */ addAlias(keyArg,aliasArg){ this.argv = this.argv.alias(keyArg,aliasArg); }; + + /** + * adds a Command by returning a Promise that reacts to the specific commandString given. + * + * Note: in e.g. "npm install something" the "install" is considered the command. + */ addCommand(definitionArg:{commandName:string}){ let done = plugins.q.defer(); this.parseStarted.promise @@ -30,6 +40,10 @@ export class Smartcli { }); return done.promise; }; + + /** + * gets a Promise for a command word + */ getCommandPromise(commandNameArg){ //TODO } diff --git a/ts/smartcli.interaction.ts b/ts/smartcli.interaction.ts deleted file mode 100644 index e69de29..0000000 diff --git a/ts/smartcli.plugins.ts b/ts/smartcli.plugins.ts index 40840d7..0235007 100644 --- a/ts/smartcli.plugins.ts +++ b/ts/smartcli.plugins.ts @@ -1,9 +1,10 @@ import "typings-global"; export let argv = require('yargs'); -export let beautylog = require("beautylog"); +export import beautylog = require("beautylog"); export let cliff = require("cliff"); export let inquirer = require("inquirer"); +export import lik = require("lik"); export let path = require("path"); -export let q = require("q"); -export let smartparam = require("smartparam"); \ No newline at end of file +export import q = require("q"); +export import smartparam = require("smartparam"); \ No newline at end of file