diff --git a/README.md b/README.md index 1dc1655..1a7748e 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ or insufficient arguments are present for an option. server: {nargs: (1..2)}, username: {nargs: 1}, password: {nargs: 1}, + color: {boolean: true}, } ``` @@ -81,9 +82,12 @@ The keys of the `options` hash can be either strings or symbols. Options that have no special flags should have an empty hash as the value. Possible option flags: + - `:short`: specify a short option letter to associate with the long option - `:nargs`: specify an exact number or range of possible numbers of arguments to the option +- `:boolean`: if true, specify that the option is a toggleable boolean + option and allow a prefix of "no" to turn it off. ### Return values diff --git a/lib/yawpa.rb b/lib/yawpa.rb index 46ac859..8d2cb46 100644 --- a/lib/yawpa.rb +++ b/lib/yawpa.rb @@ -32,6 +32,7 @@ module Yawpa # server: {nargs: (1..2)}, # username: {nargs: 1}, # password: {nargs: 1}, + # color: {boolean: true}, # } # # The keys of the +options+ Hash can be either strings or symbols. @@ -42,6 +43,8 @@ module Yawpa # - +:short+: specify a short option letter to associate with the long option # - +:nargs+: specify an exact number or range of possible numbers of # arguments to the option + # - +:boolean+: if true, specify that the option is a toggleable boolean + # option and allow a prefix of "no" to turn it off. # # @param params [Array] # List of program parameters to parse.