document :boolean option flag

This commit is contained in:
Josh Holtrop 2014-06-25 15:15:09 -04:00
parent d33d082272
commit 0eb754814e
2 changed files with 7 additions and 0 deletions

View File

@ -73,6 +73,7 @@ or insufficient arguments are present for an option.
server: {nargs: (1..2)}, server: {nargs: (1..2)},
username: {nargs: 1}, username: {nargs: 1},
password: {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. Options that have no special flags should have an empty hash as the value.
Possible option flags: Possible option flags:
- `:short`: specify a short option letter to associate with the long option - `:short`: specify a short option letter to associate with the long option
- `:nargs`: specify an exact number or range of possible numbers of - `:nargs`: specify an exact number or range of possible numbers of
arguments to the option 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 ### Return values

View File

@ -32,6 +32,7 @@ module Yawpa
# server: {nargs: (1..2)}, # server: {nargs: (1..2)},
# username: {nargs: 1}, # username: {nargs: 1},
# password: {nargs: 1}, # password: {nargs: 1},
# color: {boolean: true},
# } # }
# #
# The keys of the +options+ Hash can be either strings or symbols. # 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 # - +:short+: specify a short option letter to associate with the long option
# - +:nargs+: specify an exact number or range of possible numbers of # - +:nargs+: specify an exact number or range of possible numbers of
# arguments to the option # 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] # @param params [Array]
# List of program parameters to parse. # List of program parameters to parse.