This commit is contained in:
Philipp Kunz 2016-11-19 13:43:06 +01:00
parent f33c759fa8
commit e7c1c1c45b
11 changed files with 24 additions and 158 deletions

View File

@ -1,31 +0,0 @@
/**
* allows to specify an user interaction during runtime
*/
export declare type questionType = 'input' | 'confirm' | 'list' | 'rawlist' | 'expand' | 'checkbox' | 'password' | 'editor';
export interface IChoiceObject {
name: string;
value: any;
}
export interface IValidateFunction {
(any: any): boolean;
}
export declare class Interaction {
constructor();
askQuestion(optionsArg: {
type: questionType;
message: string;
default: any;
choices: string[] | IChoiceObject[];
validate: IValidateFunction;
}): void;
askQuestionArray: any;
}
export declare class QuestionTree {
constructor(questionString: string, optionsArray: any);
}
export declare class QuestionTreeNode {
constructor();
}
export declare class QuestionStorage {
constructor();
}

View File

@ -1,35 +0,0 @@
"use strict";
const plugins = require("./smartcli.plugins");
class Interaction {
constructor() {
}
askQuestion(optionsArg) {
let done = plugins.q.defer();
plugins.inquirer.prompt([{
type: optionsArg.type,
message: optionsArg.message,
default: optionsArg.default,
choices: optionsArg.choices,
validate: optionsArg.validate
}]).then(answers => {
done.resolve(answers);
});
}
}
exports.Interaction = Interaction;
class QuestionTree {
constructor(questionString, optionsArray) {
}
}
exports.QuestionTree = QuestionTree;
class QuestionTreeNode {
constructor() {
}
}
exports.QuestionTreeNode = QuestionTreeNode;
class QuestionStorage {
constructor() {
}
}
exports.QuestionStorage = QuestionStorage;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkuY2xhc3Nlcy5pbnRlcmFjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLmNsYXNzZXMuaW50ZXJhY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDhDQUE2QztBQWU3QztJQUNJO0lBQ0EsQ0FBQztJQUVELFdBQVcsQ0FBQyxVQU1YO1FBQ0csSUFBSSxJQUFJLE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FBSSxDQUFDLENBQUMsQ0FBQyxNQUFNLEtBQUssQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUMzQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtZQUMzQixDQUFDO1lBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ0osSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUE7WUFDMUIsQ0FBQztRQUNMLENBQUMsQ0FBQyxDQUFBO1FBQ04sTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDdkIsQ0FBQztJQUVEOztPQUVHO0lBQ0gsVUFBVTtRQUNOLElBQUksQ0FBQyxJQUFJLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUE7UUFDMUIsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLEVBQUUsQ0FBQTtRQUMzQixNQUFNLENBQUE7SUFDVixDQUFDO0NBRUo7QUF0R0QsNEJBc0dDIn0=

View File

@ -1,8 +1,7 @@
import 'typings-global'; import 'typings-global';
import * as yargs from 'yargs'; import * as yargs from 'yargs';
import * as beautylog from 'beautylog'; import * as beautylog from 'beautylog';
import * as inquirer from 'inquirer';
import * as lik from 'lik'; import * as lik from 'lik';
import * as path from 'path'; import * as path from 'path';
import * as smartparam from 'smartparam'; import * as smartparam from 'smartparam';
export { yargs, beautylog, cliff, inquirer, lik, path, smartparam }; export { yargs, beautylog, lik, path, smartparam };

View File

@ -4,12 +4,10 @@ const yargs = require("yargs");
exports.yargs = yargs; exports.yargs = yargs;
const beautylog = require("beautylog"); const beautylog = require("beautylog");
exports.beautylog = beautylog; exports.beautylog = beautylog;
const inquirer = require("inquirer");
exports.inquirer = inquirer;
const lik = require("lik"); const lik = require("lik");
exports.lik = lik; exports.lik = lik;
const path = require("path"); const path = require("path");
exports.path = path; exports.path = path;
const smartparam = require("smartparam"); const smartparam = require("smartparam");
exports.smartparam = smartparam; exports.smartparam = smartparam;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUV4QiwrQkFBOEI7QUFRMUIsZ0JBUlEsS0FBSyxDQVFSO0FBUFQsdUNBQXNDO0FBUWxDLG9CQVJRLFNBQVMsQ0FRUjtBQVBiLHFDQUFvQztBQVNoQyxtQkFUUSxRQUFRLENBU1I7QUFSWiwyQkFBMEI7QUFTdEIsY0FUUSxHQUFHLENBU1I7QUFSUCw2QkFBNEI7QUFTeEIsZUFUUSxJQUFJLENBU1I7QUFSUix5Q0FBd0M7QUFTcEMscUJBVFEsVUFBVSxDQVNSIn0= //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUV4QiwrQkFBOEI7QUFPMUIsc0JBQUs7QUFOVCx1Q0FBc0M7QUFPbEMsOEJBQVM7QUFOYiwyQkFBMEI7QUFPdEIsa0JBQUc7QUFOUCw2QkFBNEI7QUFPeEIsb0JBQUk7QUFOUix5Q0FBd0M7QUFPcEMsZ0NBQVUifQ==

View File

@ -28,18 +28,17 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartcli", "homepage": "https://gitlab.com/pushrocks/smartcli",
"dependencies": { "dependencies": {
"@types/inquirer": "0.x.x",
"@types/q": "0.x.x", "@types/q": "0.x.x",
"@types/yargs": "0.x.x", "@types/yargs": "6.x.x",
"beautylog": "^5.0.23", "beautylog": "^6.0.0",
"inquirer": "^1.2.2",
"lik": "^1.0.24", "lik": "^1.0.24",
"q": "^1.4.1", "q": "^1.4.1",
"smartparam": "0.1.1", "smartparam": "0.1.1",
"typings-global": "^1.0.14", "typings-global": "^1.0.14",
"yargs": "^6.0.0" "yargs": "^6.4.0"
}, },
"devDependencies": { "devDependencies": {
"@types/should": "^8.1.30",
"npmts-g": "^5.2.8", "npmts-g": "^5.2.8",
"should": "^11.1.1", "should": "^11.1.1",
"typings-test": "^1.0.3" "typings-test": "^1.0.3"

2
test/test.d.ts vendored
View File

@ -1 +1 @@
import "typings-test"; import 'typings-test';

View File

@ -1,36 +1,35 @@
"use strict"; "use strict";
require("typings-test"); require("typings-test");
const smartcli = require("../dist/index"); const smartcli = require("../dist/index");
let beautylog = require("beautylog"); const should = require("should");
let should = require("should"); describe('smartcli.Smartcli class', function () {
describe("smartcli.Smartcli class", function () {
let smartCliTestObject; let smartCliTestObject;
describe("new Smartcli()", function () { describe('new Smartcli()', function () {
it("should create a new Smartcli", function () { it('should create a new Smartcli', function () {
smartCliTestObject = new smartcli.Smartcli(); smartCliTestObject = new smartcli.Smartcli();
smartCliTestObject.should.be.instanceof(smartcli.Smartcli); should(smartCliTestObject).be.instanceof(smartcli.Smartcli);
}); });
}); });
describe(".addCommand", function () { describe('.addCommand', function () {
it("should add an command", function () { it('should add an command', function () {
smartCliTestObject.addCommand({ smartCliTestObject.addCommand({
commandName: "awesome" commandName: 'awesome'
}); });
}); });
}); });
describe(".standardTask", function () { describe('.standardTask', function () {
it("should start parsing a standardTask", function (done) { it('should start parsing a standardTask', function (done) {
smartCliTestObject.standardTask() smartCliTestObject.standardTask()
.then(() => { .then(() => {
console.log("this is the standard Task!"); console.log('this is the standard Task!');
}); });
done(); done();
}); });
}); });
describe(".startParse", function () { describe('.startParse', function () {
it("should start parsing the CLI input", function () { it('should start parsing the CLI input', function () {
smartCliTestObject.startParse(); smartCliTestObject.startParse();
}); });
}); });
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFzQjtBQUV0QiwwQ0FBMkM7QUFDM0MsSUFBSSxTQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ3JDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUUvQixRQUFRLENBQUMseUJBQXlCLEVBQUM7SUFDL0IsSUFBSSxrQkFBb0MsQ0FBQztJQUN6QyxRQUFRLENBQUMsZ0JBQWdCLEVBQUM7UUFDdEIsRUFBRSxDQUFDLDhCQUE4QixFQUFDO1lBQzlCLGtCQUFrQixHQUFHLElBQUksUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDO1lBQzdDLGtCQUFrQixDQUFDLE1BQU0sQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUMvRCxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDO0lBQ0gsUUFBUSxDQUFDLGFBQWEsRUFBQztRQUNuQixFQUFFLENBQUMsdUJBQXVCLEVBQUM7WUFDdkIsa0JBQWtCLENBQUMsVUFBVSxDQUFDO2dCQUMxQixXQUFXLEVBQUMsU0FBUzthQUN4QixDQUFDLENBQUM7UUFFUCxDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsQ0FBQyxDQUFDO0lBQ0gsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMscUNBQXFDLEVBQUMsVUFBUyxJQUFJO1lBQ2xELGtCQUFrQixDQUFDLFlBQVksRUFBRTtpQkFDNUIsS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0FBQztnQkFDMUIsV0FBVyxFQUFFLFNBQVM7YUFDekIsQ0FBQyxDQUFBO1FBQ04sQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtJQUNGLFFBQVEsQ0FBQyxlQUFlLEVBQUM7UUFDckIsRUFBRSxDQUFDLHFDQUFxQyxFQUFDLFVBQVMsSUFBSTtZQUNsRCxrQkFBa0IsQ0FBQyxZQUFZLEVBQUU7aUJBQzVCLElBQUksQ0FBQztnQkFDRixPQUFPLENBQUMsR0FBRyxDQUFDLDRCQUE0QixDQUFDLENBQUE7WUFDN0MsQ0FBQyxDQUFDLENBQUE7WUFDTixJQUFJLEVBQUUsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7SUFDRixRQUFRLENBQUMsYUFBYSxFQUFDO1FBQ25CLEVBQUUsQ0FBQyxvQ0FBb0MsRUFBQztZQUNwQyxrQkFBa0IsQ0FBQyxVQUFVLEVBQUUsQ0FBQTtRQUNuQyxDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

View File

@ -1,15 +1,14 @@
import 'typings-test' import 'typings-test'
import smartcli = require('../dist/index') import smartcli = require('../dist/index')
let beautylog = require('beautylog') import * as should from 'should'
let should = require('should')
describe('smartcli.Smartcli class',function(){ describe('smartcli.Smartcli class',function(){
let smartCliTestObject: smartcli.Smartcli let smartCliTestObject: smartcli.Smartcli
describe('new Smartcli()',function(){ describe('new Smartcli()',function(){
it('should create a new Smartcli',function(){ it('should create a new Smartcli',function(){
smartCliTestObject = new smartcli.Smartcli() smartCliTestObject = new smartcli.Smartcli()
smartCliTestObject.should.be.instanceof(smartcli.Smartcli) should(smartCliTestObject).be.instanceof(smartcli.Smartcli)
}) })
}) })
describe('.addCommand',function(){ describe('.addCommand',function(){

View File

@ -1,59 +0,0 @@
import * as plugins from './smartcli.plugins'
/**
* allows to specify an user interaction during runtime
*/
export type questionType = 'input' | 'confirm' | 'list' | 'rawlist' | 'expand' | 'checkbox' | 'password' | 'editor'
export interface IChoiceObject {
name: string
value: any
}
export interface IValidateFunction {
(any): boolean
}
export class Interaction {
constructor() {
}
askQuestion(optionsArg: {
type: questionType,
message: string
default: any
choices: string[] | IChoiceObject[]
validate: IValidateFunction
}) {
let done = plugins.q.defer()
plugins.inquirer.prompt([{
type: optionsArg.type,
message: optionsArg.message,
default: optionsArg.default,
choices: optionsArg.choices,
validate: optionsArg.validate
}]).then(answers => {
done.resolve(answers)
})
}
askQuestionArray
}
export class QuestionTree {
constructor(questionString: string, optionsArray) {
}
}
export class QuestionTreeNode {
constructor() {
}
}
export class QuestionStorage {
constructor() {
}
}

View File

@ -2,7 +2,6 @@ import 'typings-global';
import * as yargs from 'yargs' import * as yargs from 'yargs'
import * as beautylog from 'beautylog' import * as beautylog from 'beautylog'
import * as inquirer from 'inquirer'
import * as lik from 'lik' import * as lik from 'lik'
import * as path from 'path' import * as path from 'path'
import * as smartparam from 'smartparam' import * as smartparam from 'smartparam'
@ -10,8 +9,6 @@ import * as smartparam from 'smartparam'
export { export {
yargs, yargs,
beautylog, beautylog,
cliff,
inquirer,
lik, lik,
path, path,
smartparam smartparam