| 54 | } |
| 55 | |
| 56 | function createLogCallbacks(context: Pick<CommandContext, 'silent'>) { |
| 57 | // eslint-disable-next-line functional/no-let |
| 58 | let output = ''; |
| 59 | |
| 60 | const logOutputChunk = (message: string) => { |
| 61 | if (!context.silent) { |
| 62 | if (!output) { |
| 63 | logger.newline(); |
| 64 | } |
| 65 | logger.info(message, { noIndent: true, noLineBreak: true }); |
| 66 | } |
| 67 | output += message; |
| 68 | }; |
| 69 | |
| 70 | const logOutputEnd = () => { |
| 71 | if (!context.silent && output) { |
| 72 | logger.newline(); |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | const logSilencedOutput = () => { |
| 77 | if (context.silent) { |
| 78 | logger.newline(); |
| 79 | logger.info(output, { noIndent: true }); |
| 80 | if (!output.endsWith('\n')) { |
| 81 | logger.newline(); |
| 82 | } |
| 83 | } |
| 84 | }; |
| 85 | |
| 86 | return { logOutputChunk, logOutputEnd, logSilencedOutput }; |
| 87 | } |
| 88 | |
| 89 | function combineArgs( |
| 90 | args: string[], |