This adds test coverage for the shell.exit() function. This also
refactors how we mock stdout/stderr and adds support for mocking
process.exit() (which was needed for this change).
While I was writing these tests, I realized there was an edge case I
missed in PR #1122. This change fixes that edge case.
Issue #1013
This changes shell.exit() to use a wrapper function. This is so that
shell.errorCode() will have the correct error code after invoking
shell.exit(code). This isn't normally relevant, however a caller may be
listening for the exit status:
```
process.on('exit', code => {
shell.exit(shell.errorCode());
});
```
Issue #1013
This updates `eslint-config-airbnb-base` and `eslint-plugin-import`.
This also addresses lint errors these updates raise, and excludes
several rules.
This also adds a minor simplification to the gendocs script.
Test: npm run lint
Test: npm run gendocs
WebPack has issues with importing JSON directly and using JavaScript
methods on it. For this reason, using the `.forEach()` method on the
imported JSON array caused a method-not-found error.
Instead, we can make this a real JavaScript array by keeping it in a
JavaScript file and exporting it as a field.
It should be noted that exporting it as `exports = [...]` does not work,
because Node won't actually interpret it as a JavaScript array (with
the required methods). So instead we can export it as
`exports.list = [...]` and access the `list` field to get the real
JavaScript array of command names.
Fixes#667
* refactor: list all commands in commands.json
This also changes the order of commands in the docs, due to how I changed
the doc-generating script.
* fix lint error and alphabetize command list
If a plugin was imported before the ShellJS instance was created, the program
would crash (common.register wouldn't be instantiated yet). Now plugins can be
imported either before or after the ShellJS instance is created.
* Added uniq.js, need to add tests
* Added basic tests for uniq.js
* Implemented uniq and added tests
* Generated docs for uniq
* Fixed lint error
* Added suport for -c and -d to uniq
* Generated docs
* Fixed formatting errors. Uniq now correctly returns empty string when output is specified
* Added uniq to piped methods
* Improved comment legibility
* Cleaned up the pipeline
* Added pipe test for uniq
* Converted uniq pipe test file to use linux line endings
* Fixed linting errors