(args = parseArgs(process.argv.slice(2))._, userIsPipingInput = isUserPipingInput())
| 17 | class SimpleCLI { |
| 18 | CommandFnDecoratorSuffix = "Command" |
| 19 | async executeUsersInstructionsFromShell(args = parseArgs(process.argv.slice(2))._, userIsPipingInput = isUserPipingInput()) { |
| 20 | const command = args[0] |
| 21 | const commandName = `${command}${this.CommandFnDecoratorSuffix}` |
| 22 | if (this[commandName]) return userIsPipingInput ? this._runCommandOnPipedStdIn(commandName) : this[commandName](process.cwd(), args.slice(1)) |
| 23 | else if (command) this.log(`No command '${command}'. Running help command.`) |
| 24 | else this.log(`No command provided. Running help command.`) |
| 25 | return this.helpCommand() |
| 26 | } |
| 27 | |
| 28 | _runCommandOnPipedStdIn(commandName) { |
| 29 | this.log(`Running ${commandName} on piped input`) |
no test coverage detected