class

Docopt::ConfigOptions

Inherits Reference < Object

Constructors

new(args : Hash(String, Array(String) | Bool | Int32 | String | Nil), docopt_defaults : Hash(String, Array(String) | Bool | Float64 | Int32 | Int64 | String | Nil), config_file : Nil | Hash(String, YAML::Any) = nil, env_vars : Hash(String, String) = Hash(String, String).new)
Source

Instance methods

[](key : String) : OptionValue | Nil

Get a configuration value with precedence: CLI > env vars > config file > docopt defaults

Source
[]?(key : String) : OptionValue | Nil
Source
args

Values as docopt itself produces them; only defaults and config/env sources can widen to Int64/Float64 (see OptionValue).

Source
args=(args : Hash(String, DocoptValue | Nil))

Values as docopt itself produces them; only defaults and config/env sources can widen to Int64/Float64 (see OptionValue).

Source
config_file
Source
config_file=(config_file : Hash(String, YAML::Any) | Nil)
Source
docopt_defaults
Source
docopt_defaults=(docopt_defaults : Hash(String, OptionValue | Nil))
Source
env_vars
Source
env_vars=(env_vars : Hash(String, String))
Source
has_key?(key : String) : Bool

Whether the key resolves to a value from any tier, consistent with []: CLI, env vars, config file (with key fallbacks) and docopt defaults.

Source
to_config_yaml

The effective configuration (every option declared in the doc, resolved through the full precedence chain) as YAML text. Keys are snake_case so the output can be used as a config file directly; options that resolve to nil are omitted.

Source