garnix-io/garn

Refactor optparsing

Opened this issue · 0 comments

Our Optparse module has become very complicated, and there are further improvements, such as:

  1. not failing because of syntax errors in garn.ts when things like --help are requested
  2. showing information about why a command is unavailable
  3. showing information about commands even if they're unavailable

That would be nice, but risk making the module worse. Some refactoring is in order.

One piece of functionality that I missed that I think make this possible are commandGroups. With this, I think we can just have a normal set of parsers, and based on the situation optionally set the commandGroup and, I think, infoOption/abortOption. That should pretty dramatically simplify the module.