Closed shadowspawn closed 2 years ago
I was neglecting the exports from the shim point of view, but makes good sense from the package point of view. Done. Thanks.
8) Added tests for duck-typing of misused options, which came out of discussion in #24 and #25.
Thanks @aaronccasanova , you have picked up several errata in the comments and some good suggestions and questions.
Thanks for reviews and comments @ljharb and @Eomm and @aaronccasanova . I'll wait for @bcoe to at least have a quick look before I consider merging.
Further comments welcome from any gentle readers.
Waiting no longer. 😄
This incorporates ideas from #64, #68, and #69. Background on short options in #2.
1) Refactor parsing to use independent blocks of code, rather than nested cascading context. This makes it easier to reason about the behaviour.
2) Split out small pieces of logic to named routines to improve readability, and allow extra documentation and examples without cluttering the parsing. (Thanks to @aaronccasanova for inspiration.)
3) Existing tests untouched to make it clear that the tested functionality has not changed.
4) Be more explicit about short option group expansion, and ready to throw error in strict mode for string option in the middle of the argument. (See #11 and #74.)
5) Add support for short option combined with value (without intervening
=
). This is what Commander and Open Group Utility Conventions do, but is not what Yargs does. I don't want to block PR on this and happy to comment it out for further discussion if needed. (I have found some interesting variations in the wild.) [Edit: see also #78]6) Add support for multiple unit tests files. Expand tests from 33 to 113, but many for internal routines rather than testing exposed API.
7) Added
.editorconfig
file, mainly for my own convenience!