include commander and update README
This commit is contained in:
parent
eb3d9d722f
commit
75ab5552e1
26
README.md
26
README.md
@ -1,5 +1,5 @@
|
||||
# smartcli
|
||||
nodejs wrapper for CLI related tasks
|
||||
nodejs wrapper for CLI related tasks. TypeScript ready.
|
||||
|
||||
## Status
|
||||
[![Build Status](https://travis-ci.org/pushrocks/smartcli.svg?branch=master)](https://travis-ci.org/pushrocks/smartcli)
|
||||
@ -36,21 +36,17 @@ mytool function argument1 argument2 --option1 option1Value --option2 option2Valu
|
||||
* async interaction functions
|
||||
* are grouped in **smartcli.interaction** object
|
||||
|
||||
```js
|
||||
var smartcli = require("smartcli");
|
||||
|
||||
### Methods
|
||||
The examples are written in TypeScript
|
||||
```typescript
|
||||
import * as smartcli from "smartcli"
|
||||
|
||||
/* -------------- Check Functions -------------------*/
|
||||
//returns true for terminal command "node myjs.js jazz"
|
||||
smartcli.check.command('jazz');
|
||||
|
||||
/**
|
||||
* returns an object for terminal command "node myjs.js --myoption something" like so
|
||||
* {
|
||||
* name: 'myoption',
|
||||
* specified: true,
|
||||
* value: 'something'
|
||||
* }
|
||||
*/
|
||||
smartcli.get.option('myoption');
|
||||
smartcli.check.command("jazz"); // check for a special command.
|
||||
smartcli.check.commandPresence() // check if any command is specified
|
||||
smartcli.check.commandArguemnt("myargument") // checks if a special argument is given
|
||||
smartcli.check.commandArguemntPresence // checks of any Argument is present
|
||||
smartcli.get.option('myoption'); //
|
||||
```
|
||||
|
||||
|
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1,4 +1,3 @@
|
||||
/// <reference path="smartcli.interfaces.d.ts" />
|
||||
import SmartcliChecks = require("./smartcli.checks");
|
||||
import SmartcliGetters = require("./smartcli.getters");
|
||||
import SmartcliInteractions = require("./smartcli.interaction");
|
||||
|
3
dist/index.js
vendored
3
dist/index.js
vendored
@ -1,5 +1,4 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
/// <reference path="./smartcli.interfaces.ts" />
|
||||
"use strict";
|
||||
var plugins = require("./smartcli.plugins");
|
||||
var SmartcliChecks = require("./smartcli.checks");
|
||||
@ -24,4 +23,4 @@ exports.get = SmartcliGetters;
|
||||
* ------------------------------------------------ */
|
||||
exports.interaction = SmartcliInteractions;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBDQUEwQztBQUMxQyxpREFBaUQ7O0FBRWpELElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFDL0MsSUFBTyxjQUFjLFdBQVcsbUJBQW1CLENBQUMsQ0FBQztBQUNyRCxJQUFPLGVBQWUsV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBQ3ZELElBQU8sb0JBQW9CLFdBQVcsd0JBQXdCLENBQUMsQ0FBQztBQUVoRTs7c0RBRXNEO0FBQzNDLGdCQUFRLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDLGtDQUFrQztBQUMvRCxhQUFLLEdBQUcsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDLHFCQUFxQjtBQUM1QyxZQUFJLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLDZDQUE2QztBQUU3RTs7c0RBRXNEO0FBQzNDLGFBQUssR0FBRyxjQUFjLENBQUM7QUFFbEM7O3NEQUVzRDtBQUMzQyxXQUFHLEdBQUcsZUFBZSxDQUFDO0FBRWpDOztzREFFc0Q7QUFDM0MsbUJBQVcsR0FBRyxvQkFBb0IsQ0FBQyIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCJ0eXBpbmdzL21haW4uZC50c1wiIC8+XHJcbi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3NtYXJ0Y2xpLmludGVyZmFjZXMudHNcIiAvPlxyXG5cclx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0gKlxyXG4gKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi9cclxuZXhwb3J0IGxldCBpbnRlcmFjdGlvbiA9IFNtYXJ0Y2xpSW50ZXJhY3Rpb25zO1xyXG4iXX0=
|
||||
|
2
dist/smartcli.checks.d.ts
vendored
2
dist/smartcli.checks.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
/// <reference path="smartcli.interfaces.d.ts" />
|
||||
import "./smartcli.interfaces";
|
||||
/**
|
||||
* checks for a special command string and returns true if found.
|
||||
* @param commandString
|
||||
|
4
dist/smartcli.checks.js
vendored
4
dist/smartcli.checks.js
vendored
@ -1,6 +1,6 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
/// <reference path="./smartcli.interfaces.ts" />
|
||||
"use strict";
|
||||
require("./smartcli.interfaces");
|
||||
var plugins = require("./smartcli.plugins");
|
||||
/**
|
||||
* checks for a special command string and returns true if found.
|
||||
@ -59,4 +59,4 @@ exports.optionPresence = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmNoZWNrcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwwQ0FBMEM7QUFDMUMsaURBQWlEOztBQUVqRCxJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBRS9DOzs7O0dBSUc7QUFDUSxlQUFPLEdBQUcsVUFBUyxhQUFvQjtJQUM5QyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUM3QyxNQUFNLENBQUMsSUFBSSxDQUFBO0lBQ2YsQ0FBQztJQUNELE1BQU0sQ0FBQyxLQUFLLEN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HJldHVybiBmYWxzZTtcclxufTtcclxuXHJcbmV4cG9ydCBsZXQgY29tbWFuZEFyZ3VtZW50UHJlc2VuY2UgPSBmdW5jdGlvbihsZXZlbDpudW1iZXIgPSAxKSB7XHJcbiAgICBpZihwbHVnaW5zLmFyZ3YuXy5sZW5ndGggPj0gKGxldmVsICsgMSkpIHtcclxuICAgICAgICByZXR1cm4gdHJ1ZTtcclxuICAgIH1cclxuICAgIHJldHVybiBmYWxzZTtcclxufTtcclxuXHJcbi8qKlxyXG4gKiBjaGVja3MgZm9yIGEgc3BlY2lmaWMgb3B0aW9uIHN0cmluZywgcmV0dXJucyB0cnVlIGlmIHllcywgcmV0dXJucyBmYWxzZSBpZiBub1xyXG4gKiBAcmV0dXJucyB7Ym9vbGVhbn1cclxuICovXHJcbmV4cG9ydCBsZXQgb3B0aW9uID0gZnVuY3Rpb24ob3B0aW9uU3RyaW5nKTpib29sZWFuIHtcclxuICAgIGlmKHBsdWdpbnMuc21hcnRwYXJhbS5leGlzdHMocGx1Z2lucy5hcmd2LCBvcHRpb25TdHJpbmcpKSB7XHJcbiAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICB9XHJcbiAgICByZXR1cm4gZmFsc2U7XHJcbn07XHJcblxyXG5leHBvcnQgbGV0IG9wdGlvblByZXNlbmNlID0gZnVuY3Rpb24oKTpib29sZWFuIHtcclxuICAgIGlmIChwbHVnaW5zLmFyZ3YuaW5kZXhPZigpICE9IC0xKSB7XHJcbiAgICAgICAgcmV0dXJuIHRydWVcclxuICAgIH1cclxuICAgIHJldHVybiBmYWxzZTtcclxufTsiXX0=
|
||||
|
12
dist/smartcli.getters.d.ts
vendored
12
dist/smartcli.getters.d.ts
vendored
@ -1,21 +1,21 @@
|
||||
/// <reference path="smartcli.interfaces.d.ts" />
|
||||
import * as interfaces from "./smartcli.interfaces";
|
||||
/**
|
||||
*
|
||||
* @param commandString
|
||||
* @returns {{specified: boolean, name: any, arguments: CliCommandArgument}}
|
||||
*/
|
||||
export declare let command: () => CliCommand;
|
||||
export declare let command: () => interfaces.CliCommand;
|
||||
/**
|
||||
* gets the second or higher value of plugins.argv._ if specified and returns it as commandArgument
|
||||
* @param argumentLevel
|
||||
* @returns {{specified: (boolean|boolean), name}}
|
||||
*/
|
||||
export declare let commandArgument: (argumentLevel: any) => CliCommandArgument;
|
||||
export declare let commandArgument: (argumentLevel: any) => interfaces.CliCommandArgument;
|
||||
/**
|
||||
* returns array with commandArgs
|
||||
* @returns {CliCommandArgument[]}
|
||||
*/
|
||||
export declare let commandArgs: () => CliCommandArgument[];
|
||||
export declare let commandArgs: () => interfaces.CliCommandArgument[];
|
||||
/**
|
||||
* returns complete command array
|
||||
* @returns {any}
|
||||
@ -26,10 +26,10 @@ export declare let commandArray: () => string[];
|
||||
* @param optionName
|
||||
* @returns {CliOption}
|
||||
*/
|
||||
export declare let option: (optionName: string) => CliOption;
|
||||
export declare let option: (optionName: string) => interfaces.CliOption;
|
||||
export declare let options: () => {};
|
||||
/**
|
||||
* returns Directory of cwd
|
||||
* @returns {{path: string}}
|
||||
*/
|
||||
export declare let cwd: () => Directory;
|
||||
export declare let cwd: () => interfaces.Directory;
|
||||
|
3
dist/smartcli.getters.js
vendored
3
dist/smartcli.getters.js
vendored
File diff suppressed because one or more lines are too long
2
dist/smartcli.interaction.d.ts
vendored
2
dist/smartcli.interaction.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
/// <reference path="smartcli.interfaces.d.ts" />
|
||||
import "./smartcli.interfaces";
|
||||
/**
|
||||
* executes callback with answer to question as argument
|
||||
* @param questionString the question you want to ask the user
|
||||
|
4
dist/smartcli.interaction.js
vendored
4
dist/smartcli.interaction.js
vendored
@ -1,6 +1,6 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
/// <reference path="./smartcli.interfaces.ts" />
|
||||
"use strict";
|
||||
require("./smartcli.interfaces");
|
||||
var plugins = require("./smartcli.plugins");
|
||||
/**
|
||||
* executes callback with answer to question as argument
|
||||
@ -52,4 +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W5nXHJcbiAqIEBwYXJhbSBjaG9pY2VPcHRpb25zXHJcbiAqIEBwYXJhbSBjYlxyXG4gKiBAcmV0dXJucyB7bnVsbH1cclxuICovXHJcbmV4cG9ydCBsZXQgZ2V0Q2hvaWNlID0gZnVuY3Rpb24ocXVlc3Rpb25TdHJpbmc6c3RyaW5nLCBjaG9pY2VPcHRpb25zOnN0cmluZ1tdLCBjYikge1xyXG4gICAgaWYoIUFycmF5LmlzQXJyYXkoY2hvaWNlT3B0aW9ucykpIHtcclxuICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgIH1cclxuXHJcbiAgICAvL21ha2UgaW5xdWlyZXIgY29tcGF0aWJsZSBxdWVzdGlvbiBvYmplY3RcclxuICAgIHZhciBxdWVzdGlvbiA9IHtcclxuICAgICAgICB0eXBlOiBcImxpc3RcIixcclxuICAgICAgICBuYW1lOiBcInVzZXJGZWVkYmFja1wiLFxyXG4gICAgICAgIG1lc3NhZ2U6IHF1ZXN0aW9uU3RyaW5nLFxyXG4gICAgICAgIGNob2ljZXM6IGNob2ljZU9wdGlvbnMsXHJcbiAgICAgICAgZmlsdGVyOiBmdW5jdGlvbiggdmFsICkgeyByZXR1cm4gdmFsLnRvTG93ZXJDYXNlKCk7IH1cclxuICAgIH07XHJcblxyXG4gICAgcGx1Z2lucy5pbnF1aXJlci5wcm9tcHQocXVlc3Rpb24sZnVuY3Rpb24oYW5zd2Vycyl7XHJcbiAgICAgICAgdmFyIGFuc3dlciA9IGFuc3dlcnMudXNlckZlZWRiYWNrO1xyXG4gICAgICAgIGNiKGFuc3dlcik7XHJcbiAgICB9KTtcclxuXHJcbn07Il19
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLmludGVyYWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDBDQUEwQzs7QUFFMUMsUUFBTyx1QkFBdUIsQ0FBQyxDQ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zQXJyYXkoY2hvaWNlT3B0aW9ucykpIHtcclxuICAgICAgICByZXR1cm4gbnVsbDtcclxuICAgIH1cclxuXHJcbiAgICAvL21ha2UgaW5xdWlyZXIgY29tcGF0aWJsZSBxdWVzdGlvbiBvYmplY3RcclxuICAgIHZhciBxdWVzdGlvbiA9IHtcclxuICAgICAgICB0eXBlOiBcImxpc3RcIixcclxuICAgICAgICBuYW1lOiBcInVzZXJGZWVkYmFja1wiLFxyXG4gICAgICAgIG1lc3NhZ2U6IHF1ZXN0aW9uU3RyaW5nLFxyXG4gICAgICAgIGNob2ljZXM6IGNob2ljZU9wdGlvbnMsXHJcbiAgICAgICAgZmlsdGVyOiBmdW5jdGlvbiggdmFsICkgeyByZXR1cm4gdmFsLnRvTG93ZXJDYXNlKCk7IH1cclxuICAgIH07XHJcblxyXG4gICAgcGx1Z2lucy5pbnF1aXJlci5wcm9tcHQocXVlc3Rpb24sZnVuY3Rpb24oYW5zd2Vycyl7XHJcbiAgICAgICAgdmFyIGFuc3dlciA9IGFuc3dlcnMudXNlckZlZWRiYWNrO1xyXG4gICAgICAgIGNiKGFuc3dlcik7XHJcbiAgICB9KTtcclxuXHJcbn07Il19
|
||||
|
8
dist/smartcli.interfaces.d.ts
vendored
8
dist/smartcli.interfaces.d.ts
vendored
@ -1,17 +1,17 @@
|
||||
interface CliOption {
|
||||
export interface CliOption {
|
||||
name: string;
|
||||
specified: boolean;
|
||||
value: any;
|
||||
}
|
||||
interface Directory {
|
||||
export interface Directory {
|
||||
path: string;
|
||||
}
|
||||
interface CliCommand {
|
||||
export interface CliCommand {
|
||||
specified: boolean;
|
||||
name: string;
|
||||
arguments: CliCommandArgument[];
|
||||
}
|
||||
interface CliCommandArgument {
|
||||
export interface CliCommandArgument {
|
||||
specified: boolean;
|
||||
name: string;
|
||||
level: number;
|
||||
|
2
dist/smartcli.interfaces.js
vendored
2
dist/smartcli.interfaces.js
vendored
@ -1,3 +1,3 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzbWFydGNsaS5pbnRlcmZhY2VzLmpzIiwic291cmNlc0NvbnRlbnQiOltdfQ==
|
||||
|
1
dist/smartcli.plugins.d.ts
vendored
1
dist/smartcli.plugins.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
export declare let path: any;
|
||||
export declare let beautylog: any;
|
||||
export declare let cliff: any;
|
||||
export declare let commander: any;
|
||||
export declare let inquirer: any;
|
||||
export declare let smartparam: any;
|
||||
export declare let argv: any;
|
||||
|
3
dist/smartcli.plugins.js
vendored
3
dist/smartcli.plugins.js
vendored
@ -3,8 +3,9 @@
|
||||
exports.path = require("path");
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.cliff = require("cliff");
|
||||
exports.commander = require("commander");
|
||||
exports.inquirer = require("inquirer");
|
||||
exports.smartparam = require("smartparam");
|
||||
exports.argv = require('yargs').argv;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsMENBQTBDOztBQUUvQixZQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ3ZCLGlCQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLGFBQUssR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7QUFDekIsZ0JBQVEsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUM7QUFDL0Isa0JBQVUsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUM7QUFDbkMsWUFBSSxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQyxJQUFJLENBQU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hcnRjbGkucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCJ0eXBpbmdzL21haW4uZC50c1wiIC8+XHJcblxyXG5leHBvcnQgbGV0IHBhdGggPSByZXF1aXJlKFwicGF0aFwiKTtcclxuZXhwb3J0IGxldCBiZWF1dHlsb2cgPSByZXF1aXJlKFwiYmVhdXR5bG9nXCIpO1xyXG5leHBvcnQgbGV0IGNsaWZmID0gcmVxdWlyZShcImNsaWZmXCIpO1xyXG5leHBvcnQgbGV0IGNvbW1hbmRlciA9IHJlcXVpcmUoXCJjb21tYW5kZXJcIik7XHJcbmV4cG9ydCBsZXQgaW5xdWlyZXIgPSByZXF1aXJlKFwiaW5xdWlyZXJcIik7XHJcbmV4cG9ydCBsZXQgc21hcnRwYXJhbSA9IHJlcXVpcmUoXCJzbWFydHBhcmFtXCIpO1xyXG5leHBvcnQgbGV0IGFyZ3YgPSByZXF1aXJlKCd5YXJncycpLmFyZ3Y7Il19
|
||||
|
@ -29,6 +29,7 @@
|
||||
"dependencies": {
|
||||
"beautylog": "^4.1.6",
|
||||
"cliff": "^0.1.10",
|
||||
"commander": "^2.9.0",
|
||||
"inquirer": "^1.0.2",
|
||||
"smartparam": "0.0.7",
|
||||
"yargs": "^4.7.0"
|
||||
|
11
ts/index.ts
11
ts/index.ts
@ -1,14 +1,15 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
/// <reference path="./smartcli.interfaces.ts" />
|
||||
|
||||
import plugins = require("./smartcli.plugins");
|
||||
import SmartcliChecks = require("./smartcli.checks");
|
||||
import SmartcliGetters = require("./smartcli.getters");
|
||||
import SmartcliInteractions = require("./smartcli.interaction");
|
||||
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";
|
||||
|
||||
/* ------------------------------------------------ *
|
||||
* ---------- 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.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
/// <reference path="./smartcli.interfaces.ts" />
|
||||
|
||||
import "./smartcli.interfaces";
|
||||
import plugins = require("./smartcli.plugins");
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
/// <reference path="./smartcli.interfaces.ts" />
|
||||
|
||||
import * as interfaces from "./smartcli.interfaces";
|
||||
import plugins = require("./smartcli.plugins");
|
||||
import SmartcliChecks = require("./smartcli.checks");
|
||||
|
||||
@ -9,7 +9,7 @@ import SmartcliChecks = require("./smartcli.checks");
|
||||
* @param commandString
|
||||
* @returns {{specified: boolean, name: any, arguments: CliCommandArgument}}
|
||||
*/
|
||||
export let command = function():CliCommand {
|
||||
export let command = function():interfaces.CliCommand {
|
||||
var cliCommand = {
|
||||
specified: SmartcliChecks.commandPresence(),
|
||||
name: plugins.argv._[0],
|
||||
@ -23,8 +23,8 @@ export let command = function():CliCommand {
|
||||
* @param argumentLevel
|
||||
* @returns {{specified: (boolean|boolean), name}}
|
||||
*/
|
||||
export let commandArgument = function(argumentLevel):CliCommandArgument {
|
||||
var commandArgument:CliCommandArgument = {
|
||||
export let commandArgument = function(argumentLevel):interfaces.CliCommandArgument {
|
||||
var commandArgument:interfaces.CliCommandArgument = {
|
||||
specified: false,
|
||||
name: "undefined",
|
||||
level:argumentLevel
|
||||
@ -44,12 +44,12 @@ export let commandArgument = function(argumentLevel):CliCommandArgument {
|
||||
* returns array with commandArgs
|
||||
* @returns {CliCommandArgument[]}
|
||||
*/
|
||||
export let commandArgs = function():CliCommandArgument[] {
|
||||
var commandArgs:CliCommandArgument[] = [];
|
||||
export let commandArgs = function():interfaces.CliCommandArgument[] {
|
||||
var commandArgs:interfaces.CliCommandArgument[] = [];
|
||||
var argsArray = commandArray().slice(0);
|
||||
argsArray.shift();
|
||||
for (let item in argsArray){
|
||||
let commandArgument:CliCommandArgument = {
|
||||
let commandArgument:interfaces.CliCommandArgument = {
|
||||
specified:true,
|
||||
name:argsArray[item],
|
||||
level: parseInt(item) + 1
|
||||
@ -74,8 +74,8 @@ export let commandArray = function ():string[] {
|
||||
* @param optionName
|
||||
* @returns {CliOption}
|
||||
*/
|
||||
export let option = function(optionName:string):CliOption {
|
||||
var cliOption:CliOption = {
|
||||
export let option = function(optionName:string):interfaces.CliOption {
|
||||
var cliOption:interfaces.CliOption = {
|
||||
name:optionName,
|
||||
specified: false,
|
||||
value: false
|
||||
@ -103,7 +103,7 @@ export let options = function() {
|
||||
* returns Directory of cwd
|
||||
* @returns {{path: string}}
|
||||
*/
|
||||
export let cwd = function():Directory {
|
||||
export let cwd = function():interfaces.Directory {
|
||||
return {
|
||||
path: process.cwd()
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/// <reference path="typings/main.d.ts" />
|
||||
/// <reference path="./smartcli.interfaces.ts" />
|
||||
|
||||
import "./smartcli.interfaces";
|
||||
import plugins = require("./smartcli.plugins");
|
||||
|
||||
/**
|
||||
|
@ -1,22 +1,21 @@
|
||||
interface CliOption {
|
||||
export interface CliOption {
|
||||
name: string;
|
||||
specified:boolean;
|
||||
value: any;
|
||||
}
|
||||
|
||||
interface Directory {
|
||||
export interface Directory {
|
||||
path: string;
|
||||
}
|
||||
|
||||
interface CliCommand {
|
||||
export interface CliCommand {
|
||||
specified: boolean;
|
||||
name: string;
|
||||
arguments:CliCommandArgument[];
|
||||
}
|
||||
|
||||
interface CliCommandArgument {
|
||||
export interface CliCommandArgument {
|
||||
specified:boolean;
|
||||
name:string;
|
||||
level:number;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
export let path = require("path");
|
||||
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;
|
Loading…
Reference in New Issue
Block a user