doing 2.1.89 → 2.1.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/.irbrc +2 -0
  3. data/.rubocop.yml +1 -0
  4. data/.rubocop_todo.yml +251 -0
  5. data/CHANGELOG.md +22 -0
  6. data/Gemfile +2 -0
  7. data/Gemfile.lock +1 -1
  8. data/Rakefile +5 -3
  9. data/bin/commands/changes.rb +3 -1
  10. data/bin/commands/choose.rb +2 -0
  11. data/bin/commands/colors.rb +5 -3
  12. data/bin/commands/commands_accepting.rb +3 -3
  13. data/bin/commands/completion.rb +2 -1
  14. data/bin/commands/config.rb +8 -6
  15. data/bin/commands/done.rb +19 -12
  16. data/bin/commands/finish.rb +4 -2
  17. data/bin/commands/grep.rb +9 -5
  18. data/bin/commands/import.rb +14 -11
  19. data/bin/commands/install_fzf.rb +4 -2
  20. data/bin/commands/last.rb +31 -27
  21. data/bin/commands/meanwhile.rb +6 -2
  22. data/bin/commands/note.rb +6 -3
  23. data/bin/commands/now.rb +2 -0
  24. data/bin/commands/open.rb +6 -1
  25. data/bin/commands/plugins.rb +2 -0
  26. data/bin/commands/recent.rb +47 -33
  27. data/bin/commands/reset.rb +7 -3
  28. data/bin/commands/rotate.rb +6 -3
  29. data/bin/commands/sections.rb +3 -3
  30. data/bin/commands/select.rb +2 -0
  31. data/bin/commands/show.rb +24 -20
  32. data/bin/commands/since.rb +10 -3
  33. data/bin/commands/tag.rb +18 -16
  34. data/bin/commands/tag_dir.rb +5 -2
  35. data/bin/commands/tags.rb +17 -17
  36. data/bin/commands/template.rb +8 -2
  37. data/bin/commands/today.rb +10 -2
  38. data/bin/commands/undo.rb +2 -0
  39. data/bin/commands/update.rb +9 -7
  40. data/bin/commands/view.rb +11 -8
  41. data/bin/commands/views.rb +2 -0
  42. data/bin/commands/yesterday.rb +6 -1
  43. data/bin/doing +54 -57
  44. data/docs/doc/Array.html +3 -3
  45. data/docs/doc/BooleanTermParser/Clause.html +3 -3
  46. data/docs/doc/BooleanTermParser/Operator.html +3 -3
  47. data/docs/doc/BooleanTermParser/Query.html +3 -3
  48. data/docs/doc/BooleanTermParser/QueryParser.html +3 -3
  49. data/docs/doc/BooleanTermParser/QueryTransformer.html +3 -3
  50. data/docs/doc/BooleanTermParser.html +3 -3
  51. data/docs/doc/Doing/ArrayCleanup.html +3 -3
  52. data/docs/doc/Doing/ArrayNestedHash.html +3 -3
  53. data/docs/doc/Doing/ArrayTags.html +9 -9
  54. data/docs/doc/Doing/ByDayExport.html +3 -3
  55. data/docs/doc/Doing/CSVExport.html +4 -4
  56. data/docs/doc/Doing/CalendarImport.html +4 -4
  57. data/docs/doc/Doing/Change.html +3 -3
  58. data/docs/doc/Doing/Changes.html +3 -3
  59. data/docs/doc/Doing/ChronifyArray.html +3 -3
  60. data/docs/doc/Doing/ChronifyNumeric.html +3 -3
  61. data/docs/doc/Doing/ChronifyString.html +6 -6
  62. data/docs/doc/Doing/Color.html +88 -47
  63. data/docs/doc/Doing/Completion/BashCompletions.html +3 -3
  64. data/docs/doc/Doing/Completion/FigCompletions.html +3 -3
  65. data/docs/doc/Doing/Completion/FishCompletions.html +3 -3
  66. data/docs/doc/Doing/Completion/StringUtils.html +3 -3
  67. data/docs/doc/Doing/Completion/ZshCompletions.html +3 -3
  68. data/docs/doc/Doing/Completion.html +5 -5
  69. data/docs/doc/Doing/Configuration.html +6 -6
  70. data/docs/doc/Doing/DayOneRenderer.html +3 -3
  71. data/docs/doc/Doing/DayoneExport.html +4 -4
  72. data/docs/doc/Doing/DoingExport.html +5 -5
  73. data/docs/doc/Doing/DoingImport.html +4 -4
  74. data/docs/doc/Doing/Entry.html +3 -3
  75. data/docs/doc/Doing/Errors/DoingNoTraceError.html +3 -3
  76. data/docs/doc/Doing/Errors/DoingRuntimeError.html +3 -3
  77. data/docs/doc/Doing/Errors/DoingStandardError.html +3 -3
  78. data/docs/doc/Doing/Errors/EmptyInput.html +3 -3
  79. data/docs/doc/Doing/Errors/HistoryLimitError.html +3 -3
  80. data/docs/doc/Doing/Errors/InvalidPlugin.html +3 -3
  81. data/docs/doc/Doing/Errors/MissingBackupFile.html +3 -3
  82. data/docs/doc/Doing/Errors/NoResults.html +3 -3
  83. data/docs/doc/Doing/Errors/PluginException.html +3 -3
  84. data/docs/doc/Doing/Errors/UserCancelled.html +3 -3
  85. data/docs/doc/Doing/Errors/WrongCommand.html +3 -3
  86. data/docs/doc/Doing/Errors.html +3 -3
  87. data/docs/doc/Doing/HTMLExport.html +4 -4
  88. data/docs/doc/Doing/Hooks.html +3 -16
  89. data/docs/doc/Doing/Item.html +4 -4
  90. data/docs/doc/Doing/ItemDates.html +3 -3
  91. data/docs/doc/Doing/ItemQuery.html +3 -3
  92. data/docs/doc/Doing/ItemState.html +3 -3
  93. data/docs/doc/Doing/ItemTags.html +3 -3
  94. data/docs/doc/Doing/Items.html +3 -3
  95. data/docs/doc/Doing/JSONExport.html +4 -4
  96. data/docs/doc/Doing/JSONImport.html +4 -4
  97. data/docs/doc/Doing/Logger.html +183 -3
  98. data/docs/doc/Doing/MarkdownExport.html +4 -4
  99. data/docs/doc/Doing/Note.html +3 -3
  100. data/docs/doc/Doing/Pager.html +54 -58
  101. data/docs/doc/Doing/Plugins.html +3 -3
  102. data/docs/doc/Doing/Prompt.html +4 -4
  103. data/docs/doc/Doing/PromptChoose.html +3 -3
  104. data/docs/doc/Doing/PromptFZF.html +3 -3
  105. data/docs/doc/Doing/PromptInput.html +3 -3
  106. data/docs/doc/Doing/PromptSTD.html +3 -3
  107. data/docs/doc/Doing/PromptYN.html +3 -3
  108. data/docs/doc/Doing/Section.html +3 -3
  109. data/docs/doc/Doing/StringHighlight.html +3 -3
  110. data/docs/doc/Doing/StringNormalize.html +3 -3
  111. data/docs/doc/Doing/StringQuery.html +4 -4
  112. data/docs/doc/Doing/StringTags.html +3 -3
  113. data/docs/doc/Doing/StringTransform.html +3 -3
  114. data/docs/doc/Doing/StringTruncate.html +3 -3
  115. data/docs/doc/Doing/StringURL.html +3 -3
  116. data/docs/doc/Doing/SymbolNormalize.html +5 -5
  117. data/docs/doc/Doing/TaskPaperExport.html +4 -4
  118. data/docs/doc/Doing/TemplateExport.html +5 -5
  119. data/docs/doc/Doing/TemplateString.html +7 -7
  120. data/docs/doc/Doing/TimingImport.html +4 -4
  121. data/docs/doc/Doing/Types.html +3 -3
  122. data/docs/doc/Doing/Util/Backup.html +4 -17
  123. data/docs/doc/Doing/Util.html +56 -61
  124. data/docs/doc/Doing/Version.html +3 -3
  125. data/docs/doc/Doing/WWID.html +6 -4
  126. data/docs/doc/Doing.html +4 -4
  127. data/docs/doc/FalseClass.html +3 -3
  128. data/docs/doc/GLI/Commands/Help.html +5 -5
  129. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +3 -3
  130. data/docs/doc/GLI/Commands.html +3 -3
  131. data/docs/doc/GLI.html +3 -3
  132. data/docs/doc/Hash.html +4 -4
  133. data/docs/doc/Numeric.html +3 -3
  134. data/docs/doc/Object.html +3 -3
  135. data/docs/doc/PhraseParser/Operator.html +3 -3
  136. data/docs/doc/PhraseParser/PhraseClause.html +3 -3
  137. data/docs/doc/PhraseParser/Query.html +3 -3
  138. data/docs/doc/PhraseParser/QueryParser.html +3 -3
  139. data/docs/doc/PhraseParser/QueryTransformer.html +3 -3
  140. data/docs/doc/PhraseParser/TermClause.html +3 -3
  141. data/docs/doc/PhraseParser.html +3 -3
  142. data/docs/doc/Status.html +3 -3
  143. data/docs/doc/String.html +51 -5
  144. data/docs/doc/Symbol.html +3 -3
  145. data/docs/doc/Time.html +3 -3
  146. data/docs/doc/TrueClass.html +3 -3
  147. data/docs/doc/_index.html +4 -4
  148. data/docs/doc/class_list.html +6 -3
  149. data/docs/doc/css/full_list.css +3 -3
  150. data/docs/doc/css/style.css +6 -0
  151. data/docs/doc/file.README.html +3 -3
  152. data/docs/doc/file_list.html +5 -2
  153. data/docs/doc/frames.html +1 -1
  154. data/docs/doc/index.html +3 -3
  155. data/docs/doc/js/app.js +294 -264
  156. data/docs/doc/js/full_list.js +30 -4
  157. data/docs/doc/method_list.html +443 -392
  158. data/docs/doc/top-level-namespace.html +3 -3
  159. data/doing.gemspec +2 -0
  160. data/doing.rdoc +1 -1
  161. data/example_plugin.rb +1 -4
  162. data/lib/doing/add_options.rb +2 -2
  163. data/lib/doing/array/cleanup.rb +2 -0
  164. data/lib/doing/array/nested_hash.rb +2 -0
  165. data/lib/doing/boolean_term_parser.rb +3 -3
  166. data/lib/doing/changelog/changes.rb +4 -5
  167. data/lib/doing/changelog/version.rb +8 -11
  168. data/lib/doing/chronify/array.rb +4 -4
  169. data/lib/doing/chronify/string.rb +5 -4
  170. data/lib/doing/cli_status.rb +7 -2
  171. data/lib/doing/colors.rb +93 -51
  172. data/lib/doing/completion/bash_completion.rb +36 -39
  173. data/lib/doing/completion/completion_string.rb +2 -1
  174. data/lib/doing/completion/fig_completion.rb +33 -33
  175. data/lib/doing/completion/fish_completion.rb +22 -23
  176. data/lib/doing/completion/zsh_completion.rb +5 -5
  177. data/lib/doing/completion.rb +7 -4
  178. data/lib/doing/configuration.rb +21 -13
  179. data/lib/doing/errors.rb +1 -4
  180. data/lib/doing/good.rb +1 -1
  181. data/lib/doing/hash.rb +4 -4
  182. data/lib/doing/help_monkey_patch.rb +1 -1
  183. data/lib/doing/hooks.rb +6 -2
  184. data/lib/doing/item/dates.rb +3 -1
  185. data/lib/doing/item/query.rb +10 -10
  186. data/lib/doing/item/state.rb +2 -0
  187. data/lib/doing/logger.rb +113 -45
  188. data/lib/doing/markdown_document_listener.rb +25 -25
  189. data/lib/doing/normalize.rb +1 -1
  190. data/lib/doing/pager.rb +73 -29
  191. data/lib/doing/plugin_manager.rb +4 -5
  192. data/lib/doing/plugins/export/byday.rb +1 -1
  193. data/lib/doing/plugins/export/dayone_export.rb +28 -27
  194. data/lib/doing/plugins/export/doing_export.rb +1 -1
  195. data/lib/doing/plugins/export/html_export.rb +3 -3
  196. data/lib/doing/plugins/export/json_export.rb +4 -5
  197. data/lib/doing/plugins/export/markdown_export.rb +10 -2
  198. data/lib/doing/plugins/export/taskpaper_export.rb +1 -0
  199. data/lib/doing/plugins/export/template_export.rb +110 -107
  200. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  201. data/lib/doing/plugins/import/doing_import.rb +2 -2
  202. data/lib/doing/plugins/import/timing_import.rb +3 -3
  203. data/lib/doing/prompt/choose.rb +5 -6
  204. data/lib/doing/prompt/fzf.rb +3 -2
  205. data/lib/doing/prompt/input.rb +7 -6
  206. data/lib/doing/prompt/yn.rb +9 -11
  207. data/lib/doing/string/tags.rb +7 -4
  208. data/lib/doing/string/transform.rb +15 -10
  209. data/lib/doing/string/truncate.rb +1 -0
  210. data/lib/doing/string/url.rb +1 -1
  211. data/lib/doing/template_string.rb +13 -9
  212. data/lib/doing/time.rb +4 -2
  213. data/lib/doing/util.rb +12 -11
  214. data/lib/doing/util_backup.rb +29 -26
  215. data/lib/doing/version.rb +3 -1
  216. data/lib/doing/wwid/display.rb +182 -151
  217. data/lib/doing/wwid/editor.rb +13 -12
  218. data/lib/doing/wwid/filetools.rb +13 -11
  219. data/lib/doing/wwid/filter.rb +41 -40
  220. data/lib/doing/wwid/guess.rb +6 -8
  221. data/lib/doing/wwid/interactive.rb +9 -9
  222. data/lib/doing/wwid/modify.rb +53 -53
  223. data/lib/doing/wwid/timers.rb +4 -5
  224. data/lib/doing/wwid/wwid.rb +0 -0
  225. data/lib/doing/wwid/wwidutil.rb +8 -10
  226. data/lib/examples/commands/wiki.rb +2 -0
  227. data/lib/examples/plugins/capture_thing_import.rb +1 -1
  228. data/lib/examples/plugins/say_export.rb +1 -2
  229. data/lib/examples/plugins/wiki_export/wiki_export.rb +3 -4
  230. data/lib/helpers/fzf/test/test_go.rb +5 -5
  231. data/lib/helpers/threaded_tests.rb +20 -20
  232. data/lib/helpers/threaded_tests_string.rb +2 -0
  233. data/rdoc_to_mmd.rb +5 -4
  234. data/rdocfixer.rb +1 -2
  235. data/scripts/deploy.rb +3 -4
  236. data/scripts/generate_bash_completions.rb +40 -43
  237. data/scripts/generate_fish_completions.rb +17 -15
  238. data/scripts/generate_zsh_completions.rb +9 -7
  239. data/scripts/setting_replace.rb +1 -0
  240. data/scripts/sort_commands.rb +4 -2
  241. data/yard_templates/default/method_details/setup.rb +3 -1
  242. metadata +3 -1
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'tty-spinner'
4
5
  require 'tty-progressbar'
@@ -18,27 +19,25 @@ class ThreadedTests
18
19
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
19
20
  @results = File.expand_path('results.log')
20
21
 
21
- max_threads = 1000 if max_threads.to_i == 0
22
+ max_threads = 1000 if max_threads.to_i.zero?
22
23
 
23
24
  c = Doing::Color
24
25
  c.coloring = true
25
26
 
26
27
  shuffle = false
27
28
 
28
- unless pattern =~ /shuffle/i
29
- pattern = "test/doing_*#{pattern}*_test.rb"
30
- else
31
- pattern = "test/doing_*_test.rb"
29
+ if pattern =~ /shuffle/i
30
+ pattern = 'test/doing_*_test.rb'
32
31
  shuffle = true
32
+ else
33
+ pattern = "test/doing_*#{pattern}*_test.rb"
33
34
  end
34
35
 
35
36
  tests = Dir.glob(pattern)
36
37
 
37
38
  tests.shuffle! if shuffle
38
39
 
39
- if max_tests.to_i > 0
40
- tests = tests.slice(0, max_tests.to_i - 1)
41
- end
40
+ tests = tests.slice(0, max_tests.to_i - 1) if max_tests.to_i.positive?
42
41
 
43
42
  puts "#{tests.count} test files".boldcyan
44
43
 
@@ -94,16 +93,18 @@ class ThreadedTests
94
93
  end
95
94
  end
96
95
 
97
- @threads.each { |t| t.join }
96
+ @threads.each(&:join)
98
97
  end
99
98
 
100
99
  finish_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
101
100
 
102
101
  progress.finish
103
- rescue
102
+ rescue StandardError
104
103
  progress.stop
105
104
  ensure
106
- msg = @running_tests.map { |t| t[1].format.uncolor.sub(/^\[:bar\] (.*?):status/, "#{c.bold}#{c.white}\\1#{c.reset}#{t[2]}") }.join("\n")
105
+ msg = @running_tests.map do |t|
106
+ t[1].format.uncolor.sub(/^\[:bar\] (.*?):status/, "#{c.bold}#{c.white}\\1#{c.reset}#{t[2]}")
107
+ end.join("\n")
107
108
 
108
109
  Doing::Prompt.clear_screen(msg)
109
110
 
@@ -194,20 +195,19 @@ class ThreadedTests
194
195
  end
195
196
 
196
197
  def next_test
197
- if @children.count.positive?
198
- t = Thread.new do
199
- s = @children.shift
200
- # s[1].start
201
- # s[1].advance(status: ": #{'running'.green}")
202
- run_test(s)
203
- end
198
+ return unless @children.count.positive?
204
199
 
205
- t.join
200
+ t = Thread.new do
201
+ s = @children.shift
202
+ # s[1].start
203
+ # s[1].advance(status: ": #{'running'.green}")
204
+ run_test(s)
206
205
  end
206
+
207
+ t.join
207
208
  end
208
209
  end
209
210
 
210
-
211
211
  # require 'pastel'
212
212
  ### Individual tests, multiple spinners
213
213
  # pastel = Pastel.new
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ThreadedTestString
2
4
  class ::String
3
5
  include Doing::Color
data/rdoc_to_mmd.rb CHANGED
@@ -8,7 +8,7 @@ input.gsub!(/^===== Options/, "##### Options\n\n")
8
8
  input.gsub!(/^===== Commands/, "### Commands\n")
9
9
  input.gsub!(/^=== Commands/, "## Commands\n")
10
10
 
11
- input.gsub!(/^(?<pre>={4,6}) Command: <tt>(?<cmd>.*?) (?<arg> .*?)?<\/tt>\n(?<after>.*?)$/) do
11
+ input.gsub!(%r{^(?<pre>={4,6}) Command: <tt>(?<cmd>.*?) (?<arg> .*?)?</tt>\n(?<after>.*?)$}) do
12
12
  m = Regexp.last_match
13
13
  level = m['pre'].length == 6 ? '####' : '###'
14
14
  r = "#{level} #{m['cmd'].sub(/\|(.*?)$/, ' (*or* \1)')}"
@@ -28,15 +28,16 @@ input.gsub!(/^=== (.*?)\n+(.*?)$/) do
28
28
  m = Regexp.last_match
29
29
  "`#{m[1]}`\n: #{m[2].gsub(/\|/, '\\|')}"
30
30
  end
31
- input.gsub!(/^== (.*?) - (.*?)$\n\n(.*?)$/, "**\\1: \\2**\n\n*\\3*\n\n## Table of Contents\n{:.no_toc}\n\n* Table of Contents\n{:toc}")
31
+ input.gsub!(/^== (.*?) - (.*?)$\n\n(.*?)$/,
32
+ "**\\1: \\2**\n\n*\\3*\n\n## Table of Contents\n{:.no_toc}\n\n* Table of Contents\n{:toc}")
32
33
  input.gsub!(/^\[(Default Value|Must Match)\] (.*?)$/, ': *\1:* `\2`')
33
34
  input.gsub!(/\n (?=\S)/, ' ')
34
35
  input.gsub!(/^([^:`\n#*](.*?))$/, "\\1\n")
35
36
  input.gsub!(/\n{3,}/, "\n\n")
36
37
  input.gsub!(/^(: .*?)\n\n(:.*?)$/, "\\1\n\\2")
37
38
  input.gsub!(/^\[Default Command\] (.*?)$/, '> **Default Command:** [`\1`](#\1)')
38
- input.gsub!(/\/Users\/ttscoff\/scripts\/editor.sh/, '$EDITOR')
39
- input.gsub!(/\/Users\/ttscoff/, '~')
39
+ input.gsub!(%r{/Users/ttscoff/scripts/editor.sh}, '$EDITOR')
40
+ input.gsub!(%r{/Users/ttscoff}, '~')
40
41
  puts %(---
41
42
  layout: page
42
43
  title: "Doing - All Commands"
data/rdocfixer.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  input = $stdin.read
4
5
 
@@ -9,5 +10,3 @@ input.gsub!(/## @returns? +(.*?)$/, '## Returns \1')
9
10
  input.gsub!(/(?<= )##(?= |\n)/, '#')
10
11
 
11
12
  puts input
12
-
13
-
data/scripts/deploy.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'tty-spinner'
4
5
  require 'tty-cursor'
@@ -6,7 +7,7 @@ require 'pastel'
6
7
  require 'fileutils'
7
8
 
8
9
  pastel = Pastel.new
9
- format = "[#{pastel.yellow(':spinner')}] " + pastel.white("Release Gem")
10
+ format = "[#{pastel.yellow(':spinner')}] " + pastel.white('Release Gem')
10
11
  spinners = TTY::Spinner::Multi.new(format, format: :dots, success_mark: pastel.green('✔'), error_mark: pastel.red('✖'))
11
12
  sp_v = spinners.register "[#{pastel.cyan(':spinner')}] :msg"
12
13
  sp_t = spinners.register "[#{pastel.cyan(':spinner')}] Run tests :msg"
@@ -46,7 +47,6 @@ sp_v.run do |spinner|
46
47
  spinner.success
47
48
  end
48
49
 
49
-
50
50
  sp_t.run do |spinner|
51
51
  spinner.update(msg: '')
52
52
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
@@ -72,7 +72,6 @@ sp_d.auto_spin
72
72
  `rake yard &> results.log`
73
73
  sp_d.success
74
74
 
75
-
76
75
  sp_w.run do |spinner|
77
76
  spinner.update(msg: '- Updating All Commands')
78
77
  `./rdoc_to_mmd.rb > /Users/ttscoff/Desktop/Code/doing.wiki/commands.source`
@@ -90,7 +89,7 @@ sp_w.run do |spinner|
90
89
  sp_w.success
91
90
  end
92
91
 
93
- sp_r = spinners.register "[:spinner] Releasing gem :msg"
92
+ sp_r = spinners.register '[:spinner] Releasing gem :msg'
94
93
 
95
94
  sp_r.run do |spinner|
96
95
  spinner.update(msg: '- Preparing git release')
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'tty-progressbar'
3
5
  require 'shellwords'
4
6
 
@@ -27,37 +29,34 @@ class BashCompletions
27
29
  first = true
28
30
  out = []
29
31
  logic = []
30
- need_export = []
31
32
 
32
- @commands.each_with_index do |cmd, i|
33
+ @commands.each_with_index do |cmd, _i|
33
34
  @bar.advance(status: cmd[:commands].first)
34
35
 
35
36
  data = get_help_sections(cmd[:commands].first)
36
37
 
37
38
  arg = data[:synopsis].join(' ').strip.split(/ /).last
38
- case arg
39
- when /(path|file)/i
40
- type = :file
41
- when /sect/i
42
- type = 'sections'
43
- when /view/i
44
- type = 'views'
39
+ type = case arg
40
+ when /(path|file)/i
41
+ :file
42
+ when /sect/i
43
+ 'sections'
44
+ when /view/i
45
+ 'views'
46
+ end
47
+
48
+ next unless data[:command_options]
49
+
50
+ options = parse_options(data[:command_options])
51
+ out << command_function(cmd[:commands].first, options, type)
52
+
53
+ if first
54
+ op = 'if'
55
+ first = false
45
56
  else
46
- type = nil
47
- end
48
-
49
- if data[:command_options]
50
- options = parse_options(data[:command_options])
51
- out << command_function(cmd[:commands].first, options, type)
52
-
53
- if first
54
- op = 'if'
55
- first = false
56
- else
57
- op = 'elif'
58
- end
59
- logic << %(#{op} [[ $last =~ (#{cmd[:commands].join('|')}) ]]; then _doing_#{cmd[:commands].first})
57
+ op = 'elif'
60
58
  end
59
+ logic << %(#{op} [[ $last =~ (#{cmd[:commands].join('|')}) ]]; then _doing_#{cmd[:commands].first})
61
60
  end
62
61
 
63
62
  out << <<~EOFUNC
@@ -81,7 +80,7 @@ class BashCompletions
81
80
  def command_function(command, options, type)
82
81
  long_options = []
83
82
  short_options = []
84
-
83
+
85
84
  options.each do |o|
86
85
  next if o.nil?
87
86
 
@@ -89,25 +88,23 @@ class BashCompletions
89
88
  short_options << o[:short] if o[:short]
90
89
  end
91
90
 
92
- long = long_options.map! {|o| "--#{o}"}.join(' ')
93
- short = short_options.map! {|o| "-#{o}"}.join(' ')
91
+ long = long_options.map! { |o| "--#{o}" }.join(' ')
92
+ short = short_options.map! { |o| "-#{o}" }.join(' ')
94
93
  words = ''
95
94
  logic = ''
96
- words, logic = get_words(type) if type && type.is_a?(String)
97
-
98
- func = <<~ENDFUNC
99
- _doing_#{command}() {
100
- #{words}
101
- if [[ "$token" == --* ]]; then
102
- COMPREPLY=( $( compgen -W '#{long}' -- $token ) )
103
- elif [[ "$token" == -* ]]; then
104
- COMPREPLY=( $( compgen -W '#{short} #{long}' -- $token ) )
105
- #{logic}
106
- fi
107
- }
95
+ words, logic = get_words(type) if type.is_a?(String)
96
+
97
+ <<~ENDFUNC
98
+ _doing_#{command}() {
99
+ #{words}
100
+ if [[ "$token" == --* ]]; then
101
+ COMPREPLY=( $( compgen -W '#{long}' -- $token ) )
102
+ elif [[ "$token" == -* ]]; then
103
+ COMPREPLY=( $( compgen -W '#{short} #{long}' -- $token ) )
104
+ #{logic}
105
+ fi
106
+ }
108
107
  ENDFUNC
109
-
110
- func
111
108
  end
112
109
 
113
110
  def get_words(type)
@@ -140,8 +137,6 @@ class BashCompletions
140
137
  [func, logic]
141
138
  end
142
139
 
143
-
144
-
145
140
  def get_help_sections(command = '')
146
141
  res = `doing help #{command}`.strip
147
142
  scanned = res.scan(/(?m-i)^([A-Z ]+)\n([\s\S]*?)(?=\n+[A-Z]+|\Z)/)
@@ -157,6 +152,7 @@ class BashCompletions
157
152
  def parse_option(option)
158
153
  res = option.match(/(?:-(?<short>\w), )?(?:--(?:\[no-\])?(?<long>w+)(?:=(?<arg>\w+))?)\s+- (?<desc>.*?)$/)
159
154
  return nil unless res
155
+
160
156
  {
161
157
  short: res['short'],
162
158
  long: res['long'],
@@ -188,7 +184,8 @@ class BashCompletions
188
184
  data = get_help_sections
189
185
  @global_options = parse_options(data[:global_options])
190
186
  @commands = parse_commands(data[:commands])
191
- @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count, bar_format: :blade, status: '')
187
+ @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar] :status\033[0m",
188
+ total: @commands.count, bar_format: :blade, status: '')
192
189
  @bar.resize(25)
193
190
  end
194
191
 
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'tty-progressbar'
3
5
  require 'shellwords'
4
6
 
@@ -21,7 +23,6 @@ class ::String
21
23
  end
22
24
 
23
25
  class FishCompletions
24
-
25
26
  attr_accessor :commands, :global_options
26
27
 
27
28
  def generate_helpers
@@ -102,6 +103,7 @@ class FishCompletions
102
103
  def parse_option(option)
103
104
  res = option.match(/(?:-(?<short>\w), )?(?:--(?:\[no-\])?(?<long>w+)(?:=(?<arg>\w+))?)\s+- (?<desc>.*?)$/)
104
105
  return nil unless res
106
+
105
107
  {
106
108
  short: res['short'],
107
109
  long: res['long'],
@@ -131,7 +133,7 @@ class FishCompletions
131
133
 
132
134
  def generate_subcommand_completions
133
135
  out = []
134
- @commands.each_with_index do |cmd, i|
136
+ @commands.each_with_index do |cmd, _i|
135
137
  out << "complete -xc doing -n '__fish_doing_needs_command' -a '#{cmd[:commands].join(' ')}' -d #{Shellwords.escape(cmd[:description])}"
136
138
  end
137
139
 
@@ -139,29 +141,28 @@ class FishCompletions
139
141
  end
140
142
 
141
143
  def generate_subcommand_option_completions
142
-
143
144
  out = []
144
145
  need_export = []
145
146
 
146
- @commands.each_with_index do |cmd, i|
147
+ @commands.each_with_index do |cmd, _i|
147
148
  @bar.advance
148
149
  data = get_help_sections(cmd[:commands].first)
149
150
 
150
151
  if data[:synopsis].join(' ').strip.split(/ /).last =~ /(path|file)/i
151
- out << "complete -c doing -F -n '__fish_doing_using_command #{cmd[:commands].join(" ")}'"
152
+ out << "complete -c doing -F -n '__fish_doing_using_command #{cmd[:commands].join(' ')}'"
152
153
  end
153
154
 
154
- if data[:command_options]
155
- parse_options(data[:command_options]).each do |option|
156
- next if option.nil?
155
+ next unless data[:command_options]
157
156
 
158
- arg = option[:arg] ? '-r' : ''
159
- short = option[:short] ? "-s #{option[:short]}" : ''
160
- long = option[:long] ? "-l #{option[:long]}" : ''
161
- out << "complete -c doing #{long} #{short} -f #{arg} -n '__fish_doing_using_command #{cmd[:commands].join(' ')}' -d #{Shellwords.escape(option[:description])}"
157
+ parse_options(data[:command_options]).each do |option|
158
+ next if option.nil?
162
159
 
163
- need_export.concat(cmd[:commands]) if option[:long] == 'output'
164
- end
160
+ arg = option[:arg] ? '-r' : ''
161
+ short = option[:short] ? "-s #{option[:short]}" : ''
162
+ long = option[:long] ? "-l #{option[:long]}" : ''
163
+ out << "complete -c doing #{long} #{short} -f #{arg} -n '__fish_doing_using_command #{cmd[:commands].join(' ')}' -d #{Shellwords.escape(option[:description])}"
164
+
165
+ need_export.concat(cmd[:commands]) if option[:long] == 'output'
165
166
  end
166
167
  end
167
168
 
@@ -177,7 +178,8 @@ class FishCompletions
177
178
  data = get_help_sections
178
179
  @global_options = parse_options(data[:global_options])
179
180
  @commands = parse_commands(data[:commands])
180
- @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Fish completions: \033[0;35;40m[:bar]\033[0m", total: @commands.count, bar_format: :blade)
181
+ @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Fish completions: \033[0;35;40m[:bar]\033[0m",
182
+ total: @commands.count, bar_format: :blade)
181
183
  @bar.resize(25)
182
184
  end
183
185
 
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'tty-progressbar'
3
5
  require 'shellwords'
4
6
 
@@ -21,11 +23,10 @@ class ::String
21
23
  end
22
24
 
23
25
  class ZshCompletions
24
-
25
26
  attr_accessor :commands, :global_options
26
27
 
27
28
  def generate_helpers
28
- out=<<~EOFUNCTIONS
29
+ out = <<~EOFUNCTIONS
29
30
  compdef _doing doing
30
31
 
31
32
  function _doing() {
@@ -103,7 +104,7 @@ class ZshCompletions
103
104
 
104
105
  def generate_subcommand_completions
105
106
  out = []
106
- @commands.each_with_index do |cmd, i|
107
+ @commands.each_with_index do |cmd, _i|
107
108
  cmd[:commands].each do |c|
108
109
  out << "'#{c}:#{cmd[:description].gsub(/'/, '\\\'')}'"
109
110
  end
@@ -112,10 +113,9 @@ class ZshCompletions
112
113
  end
113
114
 
114
115
  def generate_subcommand_option_completions(indent: ' ')
115
-
116
116
  out = []
117
117
 
118
- @commands.each_with_index do |cmd, i|
118
+ @commands.each_with_index do |cmd, _i|
119
119
  @bar.advance
120
120
 
121
121
  data = get_help_sections(cmd[:commands].first)
@@ -130,7 +130,8 @@ class ZshCompletions
130
130
  option_arr << if option[:short]
131
131
  %({-#{option[:short]},--#{option[:long]}#{arg}}"[#{option[:description].gsub(/'/, '\\\'')}]")
132
132
  else
133
- %("(--#{option[:long]}#{arg})--#{option[:long]}#{arg}}[#{option[:description].gsub(/'/, '\\\'')}]")
133
+ %("(--#{option[:long]}#{arg})--#{option[:long]}#{arg}}[#{option[:description].gsub(/'/,
134
+ '\\\'')}]")
134
135
  end
135
136
  end
136
137
  end
@@ -147,7 +148,8 @@ class ZshCompletions
147
148
  data = get_help_sections
148
149
  @global_options = parse_options(data[:global_options])
149
150
  @commands = parse_commands(data[:commands])
150
- @bar = TTY::ProgressBar.new(" \033[0;0;33mGenerating Zsh completions: \033[0;35;40m[:bar]\033[0m", total: @commands.count, bar_format: :blade)
151
+ @bar = TTY::ProgressBar.new(" \033[0;0;33mGenerating Zsh completions: \033[0;35;40m[:bar]\033[0m",
152
+ total: @commands.count, bar_format: :blade)
151
153
  @bar.resize(25)
152
154
  end
153
155
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  content = IO.read(ARGV[0])
4
5
 
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'awesome_print'
3
5
 
4
- input = STDIN.read.force_encoding('utf-8')
6
+ input = $stdin.read.force_encoding('utf-8')
5
7
 
6
8
  commands = input.split(/^# @@/).delete_if(&:empty?).sort
7
9
  # commands.each do |cmd|
@@ -53,7 +55,7 @@ commands.each do |cmd|
53
55
  key = cmd.match(/^(\w+)/)[1]
54
56
  idx = indexes.index(key)
55
57
  result[idx] = "#@@#{cmd}"
56
- # puts commands.join('# @@')
58
+ # puts commands.join('# @@')
57
59
  end
58
60
 
59
61
  puts result.join('')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def source
2
- return
4
+ nil
3
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.89
4
+ version: 2.1.90
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
@@ -498,6 +498,8 @@ extra_rdoc_files:
498
498
  - README.md
499
499
  files:
500
500
  - ".irbrc"
501
+ - ".rubocop.yml"
502
+ - ".rubocop_todo.yml"
501
503
  - ".travis.yml"
502
504
  - ".yardopts"
503
505
  - AUTHORS