doing 2.1.83 → 2.1.84

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +1 -1
  5. data/docs/doc/Array.html +1 -1
  6. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  7. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  8. data/docs/doc/BooleanTermParser/Query.html +1 -1
  9. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  10. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  11. data/docs/doc/BooleanTermParser.html +1 -1
  12. data/docs/doc/Doing/ArrayCleanup.html +1 -1
  13. data/docs/doc/Doing/ArrayNestedHash.html +1 -1
  14. data/docs/doc/Doing/ArrayTags.html +1 -1
  15. data/docs/doc/Doing/ByDayExport.html +1 -1
  16. data/docs/doc/Doing/CSVExport.html +1 -1
  17. data/docs/doc/Doing/CalendarImport.html +1 -1
  18. data/docs/doc/Doing/Change.html +1 -1
  19. data/docs/doc/Doing/Changes.html +1 -1
  20. data/docs/doc/Doing/ChronifyArray.html +1 -1
  21. data/docs/doc/Doing/ChronifyNumeric.html +1 -1
  22. data/docs/doc/Doing/ChronifyString.html +1 -1
  23. data/docs/doc/Doing/Color.html +1 -1
  24. data/docs/doc/Doing/Completion/BashCompletions.html +1 -1
  25. data/docs/doc/Doing/Completion/FigCompletions.html +1 -1
  26. data/docs/doc/Doing/Completion/FishCompletions.html +1 -1
  27. data/docs/doc/Doing/Completion/StringUtils.html +1 -1
  28. data/docs/doc/Doing/Completion/ZshCompletions.html +1 -1
  29. data/docs/doc/Doing/Completion.html +1 -1
  30. data/docs/doc/Doing/Configuration.html +12 -3
  31. data/docs/doc/Doing/DayOneRenderer.html +1 -1
  32. data/docs/doc/Doing/DayoneExport.html +1 -1
  33. data/docs/doc/Doing/DoingExport.html +1 -1
  34. data/docs/doc/Doing/DoingImport.html +1 -1
  35. data/docs/doc/Doing/Entry.html +1 -1
  36. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  37. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  38. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  39. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  40. data/docs/doc/Doing/Errors/HistoryLimitError.html +1 -1
  41. data/docs/doc/Doing/Errors/InvalidPlugin.html +1 -1
  42. data/docs/doc/Doing/Errors/MissingBackupFile.html +1 -1
  43. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  44. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  45. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  46. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  47. data/docs/doc/Doing/Errors.html +1 -1
  48. data/docs/doc/Doing/HTMLExport.html +1 -1
  49. data/docs/doc/Doing/Hooks.html +1 -1
  50. data/docs/doc/Doing/Item.html +1 -1
  51. data/docs/doc/Doing/ItemDates.html +1 -1
  52. data/docs/doc/Doing/ItemQuery.html +1 -1
  53. data/docs/doc/Doing/ItemState.html +1 -1
  54. data/docs/doc/Doing/ItemTags.html +1 -1
  55. data/docs/doc/Doing/Items.html +1 -1
  56. data/docs/doc/Doing/JSONExport.html +1 -1
  57. data/docs/doc/Doing/JSONImport.html +1 -1
  58. data/docs/doc/Doing/Logger.html +1 -1
  59. data/docs/doc/Doing/MarkdownExport.html +1 -1
  60. data/docs/doc/Doing/Note.html +1 -1
  61. data/docs/doc/Doing/Pager.html +1 -1
  62. data/docs/doc/Doing/Plugins.html +1 -1
  63. data/docs/doc/Doing/Prompt.html +1 -1
  64. data/docs/doc/Doing/PromptChoose.html +1 -1
  65. data/docs/doc/Doing/PromptFZF.html +1 -1
  66. data/docs/doc/Doing/PromptInput.html +1 -1
  67. data/docs/doc/Doing/PromptSTD.html +1 -1
  68. data/docs/doc/Doing/PromptYN.html +1 -1
  69. data/docs/doc/Doing/Section.html +1 -1
  70. data/docs/doc/Doing/StringHighlight.html +1 -1
  71. data/docs/doc/Doing/StringNormalize.html +1 -1
  72. data/docs/doc/Doing/StringQuery.html +1 -1
  73. data/docs/doc/Doing/StringTags.html +1 -1
  74. data/docs/doc/Doing/StringTransform.html +1 -1
  75. data/docs/doc/Doing/StringTruncate.html +1 -1
  76. data/docs/doc/Doing/StringURL.html +1 -1
  77. data/docs/doc/Doing/SymbolNormalize.html +1 -1
  78. data/docs/doc/Doing/TaskPaperExport.html +1 -1
  79. data/docs/doc/Doing/TemplateExport.html +1 -1
  80. data/docs/doc/Doing/TemplateString.html +1 -1
  81. data/docs/doc/Doing/TimingImport.html +1 -1
  82. data/docs/doc/Doing/Types.html +1 -1
  83. data/docs/doc/Doing/Util/Backup.html +1 -1
  84. data/docs/doc/Doing/Util.html +1 -1
  85. data/docs/doc/Doing/Version.html +1 -1
  86. data/docs/doc/Doing/WWID.html +1 -1
  87. data/docs/doc/Doing.html +2 -2
  88. data/docs/doc/FalseClass.html +1 -1
  89. data/docs/doc/GLI/Commands/Help.html +1 -1
  90. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  91. data/docs/doc/GLI/Commands.html +1 -1
  92. data/docs/doc/GLI.html +1 -1
  93. data/docs/doc/Hash.html +1 -1
  94. data/docs/doc/Numeric.html +1 -1
  95. data/docs/doc/Object.html +1 -1
  96. data/docs/doc/PhraseParser/Operator.html +1 -1
  97. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  98. data/docs/doc/PhraseParser/Query.html +1 -1
  99. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  100. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  101. data/docs/doc/PhraseParser/TermClause.html +1 -1
  102. data/docs/doc/PhraseParser.html +1 -1
  103. data/docs/doc/Status.html +1 -1
  104. data/docs/doc/String.html +1 -1
  105. data/docs/doc/Symbol.html +1 -1
  106. data/docs/doc/Time.html +1 -1
  107. data/docs/doc/TrueClass.html +1 -1
  108. data/docs/doc/_index.html +1 -1
  109. data/docs/doc/file.README.html +2 -2
  110. data/docs/doc/index.html +2 -2
  111. data/docs/doc/top-level-namespace.html +1 -1
  112. data/doing.rdoc +1 -1
  113. data/lib/doing/configuration.rb +15 -2
  114. data/lib/doing/template_string.rb +2 -1
  115. data/lib/doing/time.rb +4 -4
  116. data/lib/doing/version.rb +1 -1
  117. data/lib/doing.rb +2 -2
  118. metadata +2 -2
@@ -44,6 +44,15 @@ module Doing
44
44
  'timer_format' => 'text',
45
45
  'interval_format' => 'text',
46
46
 
47
+ 'order' => 'asc',
48
+
49
+ 'shortdate_format' => {
50
+ 'today' => '%_I:%M%P',
51
+ 'this_week' => '%a %_I:%M%P',
52
+ 'this_month' => '%m/%d %_I:%M%P',
53
+ 'older' => '%m/%d/%y %_I:%M%P'
54
+ },
55
+
47
56
  'templates' => {
48
57
  'default' => {
49
58
  'date_format' => '%Y-%m-%d %H:%M',
@@ -200,7 +209,7 @@ module Doing
200
209
  ## matched, first match wins)
201
210
  ## @return [Array] ordered array of resolved keys
202
211
  ##
203
- def resolve_key_path(keypath, create: false, distance: 2)
212
+ def resolve_key_path(keypath, create: false, distance: 2, exact: false)
204
213
  cfg = @settings
205
214
  real_path = []
206
215
  unless keypath =~ /^[.*]?$/
@@ -211,7 +220,11 @@ module Doing
211
220
  new_cfg = nil
212
221
 
213
222
  if cfg.is_a?(Hash)
214
- matches = cfg.select { |key, val| key =~ path.to_rx(distance: distance) }
223
+ matches = if exact
224
+ cfg.select { |key, _| key == path }
225
+ else
226
+ cfg.select { |key, _| key =~ path.to_rx(distance: distance) }
227
+ end
215
228
  if matches.count.positive?
216
229
  shortest = matches.keys.group_by(&:length).min.last[0]
217
230
  real_path << shortest
@@ -116,7 +116,8 @@ module Doing
116
116
  pad = m['width'].to_i
117
117
  mark = m['mchar'] || ''
118
118
  if placeholder == 'shortdate' && m['width'].nil?
119
- pad = 13
119
+ fmt_string = Doing.setting('shortdate_format.older', '%m/%d/%y %_I:%M%P', exact: true)
120
+ pad = Date.today.strftime(fmt_string).length
120
121
  end
121
122
  indent = nil
122
123
  if m['ichar']
data/lib/doing/time.rb CHANGED
@@ -12,13 +12,13 @@ module Doing
12
12
  #
13
13
  def relative_date
14
14
  if self > Date.today.to_time
15
- strftime('%_I:%M%P')
15
+ strftime(Doing.setting('shortdate_format.today', '%_I:%M%P', exact: true))
16
16
  elsif self > (Date.today - 6).to_time
17
- strftime('%a %_I:%M%P')
17
+ strftime(Doing.setting('shortdate_format.this_week', '%a %_I:%M%P', exact: true))
18
18
  elsif year == Date.today.year || (year + 1 == Date.today.year && month > Date.today.month)
19
- strftime('%m/%d %_I:%M%P')
19
+ strftime(Doing.setting('shortdate_format.this_month', '%m/%d %_I:%M%P', exact: true))
20
20
  else
21
- strftime('%m/%d/%y %_I:%M%P')
21
+ strftime(Doing.setting('shortdate_format.older', '%m/%d/%y %_I:%M%P', exact: true))
22
22
  end
23
23
  end
24
24
 
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.83'
2
+ VERSION = '2.1.84'
3
3
  end
data/lib/doing.rb CHANGED
@@ -106,14 +106,14 @@ module Doing
106
106
  ## @param default A default value to return if the
107
107
  ## provided path returns nil result
108
108
  ##
109
- def setting(keypath, default = nil)
109
+ def setting(keypath, default = nil, exact: false)
110
110
  cfg = config.settings
111
111
  case keypath
112
112
  when Array
113
113
  cfg.dig(*keypath) || default
114
114
  when String
115
115
  unless keypath =~ /^[.*]?$/
116
- real_path = config.resolve_key_path(keypath, create: false)
116
+ real_path = config.resolve_key_path(keypath, create: false, distance: 0, exact: exact)
117
117
  return default unless real_path&.count&.positive?
118
118
 
119
119
  cfg = cfg.dig(*real_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.83
4
+ version: 2.1.84
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-01 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-markup