1.1.2 • Published 1 year ago
@shagos/easycli v1.1.2
EasyCLI
Usage
cli.ts
export class CLI extends EasyCLI {
constructor(options: CLIOptions) {
super(options);
this.registerCommands(new Echo());
}
}
echo.ts
export class Echo extends Command {
constructor() {
super("echo");
}
run(args: (CLIArgs | CLIFlag)[]) {
console.log(args.map((x) => x.value.join(" ")));
}
}
index.ts
let cli = new CLI({ flags: [{ name: "--someflag", consumesNextArg: true }] });
cli.handleInput();