Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(cli): add --quiet / -q option Stops any successful output. Errors are still outputted. * refactor(cli): create output functions This commit creates stdout and stderr functions for outputting with respect to isQuiet and adds support for differing (easier to parse) messages if not connected to a TTY (eg. a pipe or process substitution) Additionally changes the 'No matching files.' message to output on stderr rather than on stdout as it was, which makes sense because this output represents erroneous usage. * fix(cli): change stderr to not respect --quiet * fix(cli): change stdout to stderr in isTerminal * fix(tests): add STD(OUT/ERR)_IS_TTY env variables these variables can be set to force output on the specified chanel as if it were connected to a terminal. macro.testCLI can now take an argument of the following form: isTerminal: { stderr: false, stdout: false }, * fix(cli): improve output of CLI when not a tty * test: added tests for --verson and --help * test: add tests for --quiet * test: include isTerminal in snapshot * test: add tests for TTY detection and integration * test: typo, stderr --> stdout * fix(cli): exit code while sort is number of failed The exit code is now the number of files which failed when sorting. On a successful run, this will be 0 and exit w/ success, but if any errors occur, this will be incremented. In check mode, this is fails + unsorted. * fix: wrap file operation in try catch Wraps fs calls in trycatch to not throw and to count failures. Also better messages and script usage * docs: document changes to tty-based output * fix(test): compatability w/ node v14 * fix: compatability with node 12 * test: add tests for improper usage * test: support for node 12&14 in error test * refactor: remove extra changes to improve diff * revert: remove all tty detection * refactor: update to meet upstream * fix: fixes error reporting with quiet * fix: bad merge * style: prettier * fix: fixes permissions on cli.js * typo * refactor: improve exit code handling, and set 2 on error * feat: added summary at end of tool run * fix: better show that output on error, is an error * refactor: cleaner logic * refactor: pass `files` to `constructor` * refactor: save `matchedFilesCount` to status * fix: remove `0 files`, use `1 file` instead of `1 files` * refactor: extract `Reporter` --------- Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com> Co-authored-by: fisker Cheung <lionkay@gmail.com>
- Loading branch information