Class: Doing::Configuration
Overview
Configuration object
Constant Summary collapse
- MissingConfigFile =
Class.new(RuntimeError)
- DEFAULTS =
{ 'autotag' => { 'whitelist' => [], 'synonyms' => {} }, 'editors' => { 'default' => ENV['DOING_EDITOR'] || ENV['GIT_EDITOR'] || ENV['EDITOR'], 'doing_file' => nil, 'config' => nil, 'pager' => nil }, 'plugins' => { 'plugin_path' => File.join(Util.user_home, '.config', 'doing', 'plugins'), 'command_path' => File.join(Util.user_home, '.config', 'doing', 'commands') }, 'disabled_commands' => [], 'doing_file' => '~/.local/share/doing/what_was_i_doing.md', 'doing_file_sort' => 'desc', 'backup_dir' => '~/.local/share/doing/doing_backup', 'history_size' => 15, 'current_section' => 'Currently', 'paginate' => false, 'never_time' => [], 'never_finish' => [], 'date_tags' => ['done', 'defer(?:red)?', 'waiting'], 'timer_format' => 'text', 'interval_format' => 'text', 'templates' => { 'default' => { 'date_format' => '%Y-%m-%d %H:%M', 'template' => '%reset%cyan%shortdate %boldwhite%80║ title %boldmagenta[%boldwhite%-10section%boldmagenta]%reset %yellow%interval%boldred%duration%white%80_14┃ note', 'wrap_width' => 0, 'order' => 'asc' }, 'today' => { 'date_format' => '%_I:%M%P', 'template' => '%date: %title %interval%duration%note', 'wrap_width' => 0, 'order' => 'asc' }, 'last' => { 'date_format' => '%-I:%M%P on %a', 'template' => '%title (at %date) %interval%duration%odnote', 'wrap_width' => 88 }, 'recent' => { 'date_format' => '%_I:%M%P', 'template' => '%reset%cyan%shortdate %boldwhite%80║ title %boldmagenta[%boldwhite%-10section%boldmagenta]%reset %yellow%interval%boldred%duration%white%80_14┃ note', 'wrap_width' => 88, 'count' => 10, 'order' => 'asc' } }, 'export_templates' => {}, 'views' => { 'done' => { 'date_format' => '%_I:%M%P', 'template' => '%date | %title (%section)% 18: note', 'wrap_width' => 0, 'section' => 'All', 'count' => 0, 'order' => 'desc', 'tags' => 'done complete cancelled', 'tags_bool' => 'OR' }, 'color' => { 'date_format' => '%F %_I:%M%P', 'template' => '%boldblack%date %boldgreen| %boldwhite%title%default%note', 'wrap_width' => 0, 'section' => 'Currently', 'count' => 10, 'order' => 'asc' } }, 'marker_tag' => 'flagged', 'marker_color' => 'red', 'default_tags' => [], 'tag_sort' => 'name', 'search' => { 'matching' => 'pattern', # fuzzy, pattern, exact 'distance' => 3, 'case' => 'smart', # sensitive, ignore, smart 'highlight' => false }, 'include_notes' => true, 'interaction' => { 'confirm_longer_than' => '5h' } }
Instance Attribute Summary collapse
- #config_file ⇒ Object
- #force_answer ⇒ Object
-
#ignore_local ⇒ Object
writeonly
Sets the attribute ignore_local.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #additional_configs ⇒ Object
-
#choose_config(create: false, local: false) ⇒ String
Present a menu if there are multiple configs found.
- #config_dir ⇒ Object
-
#configure(opt = {}) ⇒ Object
Read user configuration and merge with defaults.
- #default_config_file ⇒ Object
-
#exact_match? ⇒ Boolean
Check if configuration enforces exact string matching.
- #fetch(*path, default) ⇒ Object
-
#from(user_config) ⇒ Hash
It takes the input, fills in the defaults where values do not exist.
-
#initialize(file = nil, options: {}) ⇒ Configuration
constructor
A new instance of Configuration.
-
#resolve_key_path(keypath, create: false, distance: 2) ⇒ Array
Resolve a fuzzy-matched key path.
-
#save_view(view, title) ⇒ Object
Save a set of options to the
views
configuration. -
#update_deprecated_config ⇒ Object
Method for transitioning from ~/.doingrc to ~/.config/doing/config.yml.
-
#value_for_key(keypath = '') ⇒ Hash
Get the value for a fuzzy-matched key path.
Constructor Details
#initialize(file = nil, options: {}) ⇒ Configuration
Returns a new instance of Configuration.
Instance Attribute Details
#config_file ⇒ Object
#force_answer ⇒ Object
#ignore_local=(value) ⇒ Object (writeonly)
Sets the attribute ignore_local
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
Instance Method Details
#additional_configs ⇒ Object
#choose_config(create: false, local: false) ⇒ String
Present a menu if there are multiple configs found
#config_dir ⇒ Object
#configure(opt = {}) ⇒ Object
Read user configuration and merge with defaults
#default_config_file ⇒ Object
#exact_match? ⇒ Boolean
Check if configuration enforces exact string matching
#fetch(*path, default) ⇒ Object
#from(user_config) ⇒ Hash
It takes the input, fills in the defaults where values do not exist.
#resolve_key_path(keypath, create: false, distance: 2) ⇒ Array
Resolve a fuzzy-matched key path
#save_view(view, title) ⇒ Object
Save a set of options to the views
configuration
#update_deprecated_config ⇒ Object
Method for transitioning from ~/.doingrc to ~/.config/doing/config.yml
#value_for_key(keypath = '') ⇒ Hash
Get the value for a fuzzy-matched key path