I added a logic for CNA to show help message instead of raw error stack in case a user (like me 1 hour ago) passes unknown options.
By doing so, the user can find what he/she really wanted and copy it quickly, without running help command or seeing documentation.
Explanation of work
I felt the try-catch block long so I extracted the main part in run function.
If you prefer inlined version as before, let me know.
How I tested
Ran node lib/cli.js test --unknown-options, and checked the output (for what I added)
Ran node lib/cli.js test with throw new Error('Custom Message') added before run function call, and checked the output (for backward compatibility)
Ran node lib/cli.js test, and checked the output (for backward compatibility, it shows "not empty" error with exit code 0)
This PR has no related issues.
I added a logic for CNA to show help message instead of raw error stack in case a user (like me 1 hour ago) passes unknown options. By doing so, the user can find what he/she really wanted and copy it quickly, without running
help
command or seeing documentation.Explanation of work
I felt the try-catch block long so I extracted the main part in
run
function. If you prefer inlined version as before, let me know.How I tested
node lib/cli.js test --unknown-options
, and checked the output (for what I added)node lib/cli.js test
withthrow new Error('Custom Message')
added beforerun
function call, and checked the output (for backward compatibility)node lib/cli.js test
, and checked the output (for backward compatibility, it shows "not empty" error with exit code 0)