Option types allow to check and preprocess values of options. There are 6 option types that come with optparse by default.
Our KatelloOption adds 3 more on the top of them:
Option types allow to check and preprocess values of options. There are 6 option types that come with optparse by default.
Our KatelloOption adds 3 more on the top of them:
Parse a string and try to convert it to bool value.WW
allowed values: | strings “true” and “false” at any case |
---|---|
return type: | bool |
arguments: | none |
# usage:
parser.add_option('--enable', dest='enable', type="bool")
Parse a string and try to tear it by a delimiter into a list of substrings.[[BR]] If no delimiter is found in the string the original value is returned as the only item of the list.
allowed values: | string (can contain the delimiter) |
---|---|
return type: | list of strings |
arguments: |
|
# usage:
parser.add_option('--package', dest='package', type="list", delimiter=",")
Parses an url string that starts with a given scheme (“http” and “https” is accepted by default). Throws an exception if the value is not a valid url.
allowed values: | string with valid url path |
---|---|
return type: | string |
arguments: |
|
# usage:
parser.add_option('--feed', dest='feed', type="url", schemes=['https'])