UNPKG

914 BPlain TextView Raw
1import {NestedYargs, NestedYargsCategory} from "../interfaces/nested-yargs-wrapper";
2import {injectable} from 'inversify';
3import {Command} from "../interfaces/command";
4@injectable()
5export class NestedYargsImpl implements NestedYargs {
6 private nestedYargs = require('nested-yargs');
7
8 createApp(options: any): NestedYargsCategory {
9 return this.nestedYargs.createApp(options);
10 }
11
12 createCommand(alias: string, commandDesc: string, handler: Command): NestedYargsCategory {
13 return this.nestedYargs.createCommand(alias, commandDesc, handler);
14 }
15
16 createCategory(alias: string, commandDesc: string): NestedYargsCategory {
17 return this.nestedYargs.createCategory(alias, commandDesc);
18 }
19
20 run(app: NestedYargsCategory, unitTestArgs:string[] = []): void {
21 let yargs = unitTestArgs.length
22 ? require('yargs')(unitTestArgs)
23 : null;
24 return this.nestedYargs.run(app, yargs);
25 }
26}
27