Adds -A to disable terminal control codes in the output. #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses #72
With minimal refactoring, I minimized the changes needed to support parameters more easily, and thereby minimized the amount of code needed to add this feature. These changes are backwards compatible except for error cases; in particular, flags may now appear before or after options, whereas before they could only appear before options. For example, prior to this patch, this would cause an error:
but worse, this would kill all services:
With this patch, arguments and flags are parsed correctly: all flags appear before arguments, which is required for
flags.Parse()to work correctly. The positional logic has been largely removed, making adding flags far easier. All of the positional logic has been moved to a single block of 10 lines, making the flow easier to understand, and less fragile. Validation of arguments has been collected and simplified.This is still not a completely correct use of the flags library, and there remain vestigual anachronisms, such as around line 45, but a fully idiomatic refactoring would be a larger and more disruptive patch.