Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some tools need to allow the repeated input of certain valueless parameters. One such example is the use of `v` for `verbose`, where the addition of more v's increases the verbosity of the output. This behavior can be seen in tools such as curl and ssh. Prior to this change, when the `:multi` option was passed in to a `:flag` or `:boolean` parameter, the parser would return either a a `true` value or an empty array depending on if the flag was passed in the command line or not. After this change, the `:flag` with `:multi` set will instead count the number of times the flag was passed. Flag options without `:multi` set still exhibit the original behavior of simple `true`/`false` values. Example config: ```ruby opts = Optimist::options do opt :verbose, "Enables verbose output. Twice will enable very-verbose output", multi: true end ``` Before change: ``` $ mytool {:verbose => []} $ mytool -vvv {:verbose => true} ``` After change: ``` $ mytool {:verbose => 0} $ mytool -vv {:verbose => 3} ```
- Loading branch information