fix(structure): remove dist/ dir from git repo
This commit is contained in:
parent
9d1f0f22ba
commit
c4e5ba6587
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export { Smartcli } from './smartcli.classes.smartcli';
|
|
5
dist/index.js
vendored
5
dist/index.js
vendored
@ -1,5 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
var smartcli_classes_smartcli_1 = require("./smartcli.classes.smartcli");
|
|
||||||
exports.Smartcli = smartcli_classes_smartcli_1.Smartcli;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlFQUF1RDtBQUE5QywrQ0FBQSxRQUFRLENBQUEifQ==
|
|
72
dist/smartcli.classes.smartcli.d.ts
vendored
72
dist/smartcli.classes.smartcli.d.ts
vendored
@ -1,72 +0,0 @@
|
|||||||
import * as smartq from 'smartq';
|
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
import * as plugins from './smartcli.plugins';
|
|
||||||
export interface ICommandPromiseObject {
|
|
||||||
commandName: string;
|
|
||||||
promise: Promise<void>;
|
|
||||||
}
|
|
||||||
export interface ITriggerObservableObject {
|
|
||||||
triggerName: string;
|
|
||||||
subject: Subject<any>;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* class to create a new instance of Smartcli. Handles parsing of command line arguments.
|
|
||||||
*/
|
|
||||||
export declare class Smartcli {
|
|
||||||
argv: any;
|
|
||||||
questionsDone: any;
|
|
||||||
parseStarted: smartq.Deferred<any>;
|
|
||||||
commands: any;
|
|
||||||
questions: any;
|
|
||||||
version: string;
|
|
||||||
private onlyOnProcessEnvCliCall;
|
|
||||||
/**
|
|
||||||
* map of all Trigger/Observable objects to keep track
|
|
||||||
*/
|
|
||||||
allTriggerObservablesMap: plugins.lik.Objectmap<ITriggerObservableObject>;
|
|
||||||
/**
|
|
||||||
* The constructor of Smartcli
|
|
||||||
*/
|
|
||||||
constructor();
|
|
||||||
/**
|
|
||||||
* halts any execution of commands if (process.env.CLI_CALL === false)
|
|
||||||
*/
|
|
||||||
onlyTriggerOnProcessEnvCliCall(): void;
|
|
||||||
/**
|
|
||||||
* adds an alias, meaning one equals the other in terms of command execution.
|
|
||||||
*/
|
|
||||||
addCommandAlias(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(commandNameArg: string): Subject<any>;
|
|
||||||
/**
|
|
||||||
* adds a Trigger. Like addCommand(), but returns an subscribable observable
|
|
||||||
*/
|
|
||||||
addTrigger(triggerNameArg: string): Subject<any>;
|
|
||||||
/**
|
|
||||||
* execute trigger by name
|
|
||||||
* @param commandNameArg - the name of the command to trigger
|
|
||||||
*/
|
|
||||||
trigger(triggerName: string): Subject<any>;
|
|
||||||
getTriggerSubject(triggerName: string): Subject<any>;
|
|
||||||
/**
|
|
||||||
* allows to specify help text to be printed above the rest of the help text
|
|
||||||
*/
|
|
||||||
addHelp(optionsArg: {
|
|
||||||
helpText: string;
|
|
||||||
}): void;
|
|
||||||
/**
|
|
||||||
* specify version to be printed for -v --version
|
|
||||||
*/
|
|
||||||
addVersion(versionArg: string): void;
|
|
||||||
/**
|
|
||||||
* adds a trigger that is called when no command is specified
|
|
||||||
*/
|
|
||||||
standardTask(): Subject<any>;
|
|
||||||
/**
|
|
||||||
* start the process of evaluating commands
|
|
||||||
*/
|
|
||||||
startParse(): void;
|
|
||||||
}
|
|
139
dist/smartcli.classes.smartcli.js
vendored
139
dist/smartcli.classes.smartcli.js
vendored
@ -1,139 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const smartq = require("smartq");
|
|
||||||
const rxjs_1 = require("rxjs");
|
|
||||||
const plugins = require("./smartcli.plugins");
|
|
||||||
// import classes
|
|
||||||
const lik_1 = require("lik");
|
|
||||||
/**
|
|
||||||
* class to create a new instance of Smartcli. Handles parsing of command line arguments.
|
|
||||||
*/
|
|
||||||
class Smartcli {
|
|
||||||
/**
|
|
||||||
* The constructor of Smartcli
|
|
||||||
*/
|
|
||||||
constructor() {
|
|
||||||
this.onlyOnProcessEnvCliCall = false;
|
|
||||||
/**
|
|
||||||
* map of all Trigger/Observable objects to keep track
|
|
||||||
*/
|
|
||||||
this.allTriggerObservablesMap = new lik_1.Objectmap();
|
|
||||||
this.argv = plugins.yargs;
|
|
||||||
this.questionsDone = smartq.defer();
|
|
||||||
this.parseStarted = smartq.defer();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* halts any execution of commands if (process.env.CLI_CALL === false)
|
|
||||||
*/
|
|
||||||
onlyTriggerOnProcessEnvCliCall() {
|
|
||||||
this.onlyOnProcessEnvCliCall = true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* adds an alias, meaning one equals the other in terms of command execution.
|
|
||||||
*/
|
|
||||||
addCommandAlias(keyArg, aliasArg) {
|
|
||||||
this.argv = this.argv.alias(keyArg, aliasArg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 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(commandNameArg) {
|
|
||||||
let triggerSubject = this.addTrigger(commandNameArg);
|
|
||||||
this.parseStarted.promise.then(() => {
|
|
||||||
if (this.argv._.indexOf(commandNameArg) === 0) {
|
|
||||||
this.trigger(commandNameArg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return triggerSubject;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* adds a Trigger. Like addCommand(), but returns an subscribable observable
|
|
||||||
*/
|
|
||||||
addTrigger(triggerNameArg) {
|
|
||||||
let triggerSubject = new rxjs_1.Subject();
|
|
||||||
if (!this.getTriggerSubject(triggerNameArg)) {
|
|
||||||
this.allTriggerObservablesMap.add({
|
|
||||||
triggerName: triggerNameArg,
|
|
||||||
subject: triggerSubject
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`you can't add a trigger twice`);
|
|
||||||
}
|
|
||||||
return triggerSubject;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* execute trigger by name
|
|
||||||
* @param commandNameArg - the name of the command to trigger
|
|
||||||
*/
|
|
||||||
trigger(triggerName) {
|
|
||||||
let triggerSubject = this.getTriggerSubject(triggerName);
|
|
||||||
triggerSubject.next(this.argv);
|
|
||||||
return triggerSubject;
|
|
||||||
}
|
|
||||||
getTriggerSubject(triggerName) {
|
|
||||||
const triggerObservableObject = this.allTriggerObservablesMap.find(triggerObservableObjectArg => {
|
|
||||||
return triggerObservableObjectArg.triggerName === triggerName;
|
|
||||||
});
|
|
||||||
if (triggerObservableObject) {
|
|
||||||
return triggerObservableObject.subject;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* allows to specify help text to be printed above the rest of the help text
|
|
||||||
*/
|
|
||||||
addHelp(optionsArg) {
|
|
||||||
this.addCommand('help').subscribe(argvArg => {
|
|
||||||
plugins.beautylog.log(optionsArg.helpText);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* specify version to be printed for -v --version
|
|
||||||
*/
|
|
||||||
addVersion(versionArg) {
|
|
||||||
this.version = versionArg;
|
|
||||||
this.addCommandAlias('v', 'version');
|
|
||||||
this.parseStarted.promise.then(() => {
|
|
||||||
if (this.argv.v) {
|
|
||||||
console.log(this.version);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* adds a trigger that is called when no command is specified
|
|
||||||
*/
|
|
||||||
standardTask() {
|
|
||||||
let standardSubject = this.addTrigger('standardTask');
|
|
||||||
this.parseStarted.promise.then(() => {
|
|
||||||
if (this.argv._.length === 0 && !this.argv.v) {
|
|
||||||
if (this.onlyOnProcessEnvCliCall) {
|
|
||||||
if (process.env.CLI_CALL === 'true') {
|
|
||||||
this.trigger('standardTask');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.trigger('standardTask');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return standardSubject;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* start the process of evaluating commands
|
|
||||||
*/
|
|
||||||
startParse() {
|
|
||||||
this.argv = this.argv.argv;
|
|
||||||
this.parseStarted.resolve();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Smartcli = Smartcli;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkuY2xhc3Nlcy5zbWFydGNsaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLmNsYXNzZXMuc21hcnRjbGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpQ0FBaUM7QUFDakMsK0JBQStCO0FBRS9CLDhDQUE4QztBQUU5QyxpQkFBaUI7QUFDakIsNkJBQWdDO0FBYWhDOztHQUVHO0FBQ0g7SUFjRTs7T0FFRztJQUNIO1FBVlEsNEJBQXVCLEdBQUcsS0FBSyxDQUFDO1FBRXhDOztXQUVHO1FBQ0gsNkJBQXdCLEdBQUcsSUFBSSxlQUFTLEVBQTRCLENBQUM7UUFNbkUsSUFBSSxDQUFDLElBQUksR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFDO1FBQzFCLElBQUksQ0FBQyxhQUFhLEdBQUcsTUFBTSxDQUFD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BRUQ7O09BRUc7SUFDSCxVQUFVO1FBQ1IsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQztRQUMzQixJQUFJLENBQUMsWUFBWSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQzVCLE9BQU87SUFDVCxDQUFDO0NBQ0Y7QUE5SUQsNEJBOElDIn0=
|
|
6
dist/smartcli.plugins.d.ts
vendored
6
dist/smartcli.plugins.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
import * as yargs from 'yargs';
|
|
||||||
import * as beautylog from 'beautylog';
|
|
||||||
import * as lik from 'lik';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as smartparam from 'smartparam';
|
|
||||||
export { yargs, beautylog, lik, path, smartparam };
|
|
13
dist/smartcli.plugins.js
vendored
13
dist/smartcli.plugins.js
vendored
@ -1,13 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const yargs = require("yargs");
|
|
||||||
exports.yargs = yargs;
|
|
||||||
const beautylog = require("beautylog");
|
|
||||||
exports.beautylog = beautylog;
|
|
||||||
const lik = require("lik");
|
|
||||||
exports.lik = lik;
|
|
||||||
const path = require("path");
|
|
||||||
exports.path = path;
|
|
||||||
const smartparam = require("smartparam");
|
|
||||||
exports.smartparam = smartparam;
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRjbGkucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Y2xpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQkFBK0I7QUFNdEIsc0JBQUs7QUFMZCx1Q0FBdUM7QUFLdkIsOEJBQVM7QUFKekIsMkJBQTJCO0FBSUEsa0JBQUc7QUFIOUIsNkJBQTZCO0FBR0csb0JBQUk7QUFGcEMseUNBQXlDO0FBRUgsZ0NBQVUifQ==
|
|
Loading…
Reference in New Issue
Block a user