Class: Doing::Configuration
- Inherits:
-
Object
- Object
- Doing::Configuration
- Defined in:
- lib/doing/configuration.rb
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 }, 'plugins' => { 'plugin_path' => File.join(Util.user_home, '.config', 'doing', 'plugins'), 'command_path' => File.join(Util.user_home, '.config', 'doing', 'commands') }, 'doing_file' => '~/.local/share/doing/what_was_i_doing.md', 'backup_dir' => '~/.local/share/doing/doing_backup', '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 %dark%boldmagenta[%boldwhite%-10section%boldmagenta]%reset %yellow%interval%boldred%duration%dark%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 %dark%boldmagenta[%boldwhite%-10section%boldmagenta]%reset %yellow%interval%boldred%duration%dark%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 }, 'include_notes' => true }
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 ⇒ 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.
-
#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) ⇒ Array
Resolve a fuzzy-matched key path.
-
#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 ⇒ 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
#from(user_config) ⇒ Hash
It takes the input, fills in the defaults where values do not exist.
#resolve_key_path(keypath, create: false) ⇒ Array
Resolve a fuzzy-matched key path
#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