Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It may sound a little weird to have to use
this.context.stdout.write
to write to the console in a Node context (developers are used to just callconsole.log
for that). While it's important to keep this distinction in order to let commands be chainable (ie one command may call others and capture their output), newest Node releases may provide us an interesting tool to improve the user experience.This diff introduces a new option,
enableCapture
. When set (the default isfalse
at the moment), passing non-standard streams to a CLI execution will cause Clipanion to register itself into theprocess.stdout.write
pipeline (same for stderr), effectively capturing everything that JS code would print. Asynchronicity shouldn't be an issue thanks toAsyncLocalStorage
, which will ensure that each command access their own streams, even if asynchronous.