(commandName: string, wrapper: ToolCommandWrapper<U>)
| 56 | } |
| 57 | |
| 58 | export function wrapCommand<U>(commandName: string, wrapper: ToolCommandWrapper<U>) { |
| 59 | if (typeof commandName !== 'string') { |
| 60 | log('apiCommandNameInvalid_0200', 'command'); |
| 61 | } else if (typeof wrapper !== 'function') { |
| 62 | log('apiArgumentInvalid_0201', 'wrapper', 'command'); |
| 63 | } else { |
| 64 | findAll(commandName, (command) => { |
| 65 | const current = command.run; |
| 66 | command.run = (args) => wrapper(args, current); |
| 67 | }); |
| 68 | } |
| 69 | |
| 70 | return this; |
| 71 | } |
| 72 | |
| 73 | export function beforeCommand<U>(commandName: string, before: ToolCommandRunner<U>) { |
| 74 | if (typeof commandName !== 'string') { |
no test coverage detected