module Mixlib::CLI::ClassMethods
def banner(bstring = nil)
=== Returns
bstring
=== Parameters
Usage: #{0} (options)
Change the banner. Defaults to:
def banner(bstring = nil) if bstring @banner = bstring else @banner ||= "Usage: #{$0} (options)" @banner end end
def deprecated_option(name,
=== Returns
to non-deprecated keys in your code.
if no replacement is provided. You can use this to enforce the transition
only the value in `replacement` will be set. Results undefined
populated when the deprecated flag is used. If set to false,
keep
assigned directly to the converted option.
If not provided, the value provided to the deprecated option will be
and converts it to a value suitable for the new option.
value_mapper
boolean
short
long
replacement
name
Add a deprecated command line option.
Declare a deprecated option
def deprecated_option(name, replacement: nil, long: nil, short: nil, boolean: false, value_mapper: nil, keep: true) description = if replacement replacement_cfg = options[replacement] display_name = CLI::Formatter.combined_option_display_name(replacement_cfg[:short], replacement_cfg[:long]) "This flag is deprecated. Use #{display_name} instead." else "This flag is deprecated and will be removed in a future release." end value_mapper ||= Proc.new { |v| v } option(name, long: long, short: short, boolean: boolean, description: description, on: :tail, deprecated: true, keep: keep, replacement: replacement, value_mapper: value_mapper) end
def option(name, args)
-
(Hash)
- :: the config hash for the created option
def option(name, args) @options ||= {} raise(ArgumentError, "Option name must be a symbol") unless name.is_a?(Symbol) @options[name.to_sym] = args end
def options
=== Returns
Get the hash of current options.
def options @options ||= {} @options end
def options=(val)
=== Returns
val
=== Parameters
Set the current options hash
def options=(val) raise(ArgumentError, "Options must receive a hash") unless val.is_a?(Hash) @options = val end
def use_separate_default_options(true_or_false)
When this setting is set to +true+, default values supplied to the
def use_separate_default_options(true_or_false) @separate_default_options = true_or_false end
def use_separate_defaults?
def use_separate_defaults? @separate_default_options ||= false end