(commandName: string, before: ToolCommandRunner<U>)
| 71 | } |
| 72 | |
| 73 | export function beforeCommand<U>(commandName: string, before: ToolCommandRunner<U>) { |
| 74 | if (typeof commandName !== 'string') { |
| 75 | log('apiCommandNameInvalid_0200', 'before command'); |
| 76 | } else if (typeof before !== 'function') { |
| 77 | log('apiArgumentInvalid_0201', 'before', 'before command'); |
| 78 | } else { |
| 79 | wrapCommand<U>(commandName, async (args, current) => { |
| 80 | await before(args); |
| 81 | await current(args); |
| 82 | }); |
| 83 | } |
| 84 | |
| 85 | return this; |
| 86 | } |
| 87 | |
| 88 | export function afterCommand<U>(commandName: string, after: ToolCommandRunner<U>) { |
| 89 | if (typeof commandName !== 'string') { |
nothing calls this directly
no test coverage detected