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.
- checksums.yaml +4 -4
- data/.irbrc +2 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +251 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +5 -3
- data/bin/commands/changes.rb +3 -1
- data/bin/commands/choose.rb +2 -0
- data/bin/commands/colors.rb +5 -3
- data/bin/commands/commands_accepting.rb +3 -3
- data/bin/commands/completion.rb +2 -1
- data/bin/commands/config.rb +8 -6
- data/bin/commands/done.rb +19 -12
- data/bin/commands/finish.rb +4 -2
- data/bin/commands/grep.rb +9 -5
- data/bin/commands/import.rb +14 -11
- data/bin/commands/install_fzf.rb +4 -2
- data/bin/commands/last.rb +31 -27
- data/bin/commands/meanwhile.rb +6 -2
- data/bin/commands/note.rb +6 -3
- data/bin/commands/now.rb +2 -0
- data/bin/commands/open.rb +6 -1
- data/bin/commands/plugins.rb +2 -0
- data/bin/commands/recent.rb +47 -33
- data/bin/commands/reset.rb +7 -3
- data/bin/commands/rotate.rb +6 -3
- data/bin/commands/sections.rb +3 -3
- data/bin/commands/select.rb +2 -0
- data/bin/commands/show.rb +24 -20
- data/bin/commands/since.rb +10 -3
- data/bin/commands/tag.rb +18 -16
- data/bin/commands/tag_dir.rb +5 -2
- data/bin/commands/tags.rb +17 -17
- data/bin/commands/template.rb +8 -2
- data/bin/commands/today.rb +10 -2
- data/bin/commands/undo.rb +2 -0
- data/bin/commands/update.rb +9 -7
- data/bin/commands/view.rb +11 -8
- data/bin/commands/views.rb +2 -0
- data/bin/commands/yesterday.rb +6 -1
- data/bin/doing +54 -57
- data/docs/doc/Array.html +3 -3
- data/docs/doc/BooleanTermParser/Clause.html +3 -3
- data/docs/doc/BooleanTermParser/Operator.html +3 -3
- data/docs/doc/BooleanTermParser/Query.html +3 -3
- data/docs/doc/BooleanTermParser/QueryParser.html +3 -3
- data/docs/doc/BooleanTermParser/QueryTransformer.html +3 -3
- data/docs/doc/BooleanTermParser.html +3 -3
- data/docs/doc/Doing/ArrayCleanup.html +3 -3
- data/docs/doc/Doing/ArrayNestedHash.html +3 -3
- data/docs/doc/Doing/ArrayTags.html +9 -9
- data/docs/doc/Doing/ByDayExport.html +3 -3
- data/docs/doc/Doing/CSVExport.html +4 -4
- data/docs/doc/Doing/CalendarImport.html +4 -4
- data/docs/doc/Doing/Change.html +3 -3
- data/docs/doc/Doing/Changes.html +3 -3
- data/docs/doc/Doing/ChronifyArray.html +3 -3
- data/docs/doc/Doing/ChronifyNumeric.html +3 -3
- data/docs/doc/Doing/ChronifyString.html +6 -6
- data/docs/doc/Doing/Color.html +88 -47
- data/docs/doc/Doing/Completion/BashCompletions.html +3 -3
- data/docs/doc/Doing/Completion/FigCompletions.html +3 -3
- data/docs/doc/Doing/Completion/FishCompletions.html +3 -3
- data/docs/doc/Doing/Completion/StringUtils.html +3 -3
- data/docs/doc/Doing/Completion/ZshCompletions.html +3 -3
- data/docs/doc/Doing/Completion.html +5 -5
- data/docs/doc/Doing/Configuration.html +6 -6
- data/docs/doc/Doing/DayOneRenderer.html +3 -3
- data/docs/doc/Doing/DayoneExport.html +4 -4
- data/docs/doc/Doing/DoingExport.html +5 -5
- data/docs/doc/Doing/DoingImport.html +4 -4
- data/docs/doc/Doing/Entry.html +3 -3
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +3 -3
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +3 -3
- data/docs/doc/Doing/Errors/DoingStandardError.html +3 -3
- data/docs/doc/Doing/Errors/EmptyInput.html +3 -3
- data/docs/doc/Doing/Errors/HistoryLimitError.html +3 -3
- data/docs/doc/Doing/Errors/InvalidPlugin.html +3 -3
- data/docs/doc/Doing/Errors/MissingBackupFile.html +3 -3
- data/docs/doc/Doing/Errors/NoResults.html +3 -3
- data/docs/doc/Doing/Errors/PluginException.html +3 -3
- data/docs/doc/Doing/Errors/UserCancelled.html +3 -3
- data/docs/doc/Doing/Errors/WrongCommand.html +3 -3
- data/docs/doc/Doing/Errors.html +3 -3
- data/docs/doc/Doing/HTMLExport.html +4 -4
- data/docs/doc/Doing/Hooks.html +3 -16
- data/docs/doc/Doing/Item.html +4 -4
- data/docs/doc/Doing/ItemDates.html +3 -3
- data/docs/doc/Doing/ItemQuery.html +3 -3
- data/docs/doc/Doing/ItemState.html +3 -3
- data/docs/doc/Doing/ItemTags.html +3 -3
- data/docs/doc/Doing/Items.html +3 -3
- data/docs/doc/Doing/JSONExport.html +4 -4
- data/docs/doc/Doing/JSONImport.html +4 -4
- data/docs/doc/Doing/Logger.html +183 -3
- data/docs/doc/Doing/MarkdownExport.html +4 -4
- data/docs/doc/Doing/Note.html +3 -3
- data/docs/doc/Doing/Pager.html +54 -58
- data/docs/doc/Doing/Plugins.html +3 -3
- data/docs/doc/Doing/Prompt.html +4 -4
- data/docs/doc/Doing/PromptChoose.html +3 -3
- data/docs/doc/Doing/PromptFZF.html +3 -3
- data/docs/doc/Doing/PromptInput.html +3 -3
- data/docs/doc/Doing/PromptSTD.html +3 -3
- data/docs/doc/Doing/PromptYN.html +3 -3
- data/docs/doc/Doing/Section.html +3 -3
- data/docs/doc/Doing/StringHighlight.html +3 -3
- data/docs/doc/Doing/StringNormalize.html +3 -3
- data/docs/doc/Doing/StringQuery.html +4 -4
- data/docs/doc/Doing/StringTags.html +3 -3
- data/docs/doc/Doing/StringTransform.html +3 -3
- data/docs/doc/Doing/StringTruncate.html +3 -3
- data/docs/doc/Doing/StringURL.html +3 -3
- data/docs/doc/Doing/SymbolNormalize.html +5 -5
- data/docs/doc/Doing/TaskPaperExport.html +4 -4
- data/docs/doc/Doing/TemplateExport.html +5 -5
- data/docs/doc/Doing/TemplateString.html +7 -7
- data/docs/doc/Doing/TimingImport.html +4 -4
- data/docs/doc/Doing/Types.html +3 -3
- data/docs/doc/Doing/Util/Backup.html +4 -17
- data/docs/doc/Doing/Util.html +56 -61
- data/docs/doc/Doing/Version.html +3 -3
- data/docs/doc/Doing/WWID.html +6 -4
- data/docs/doc/Doing.html +4 -4
- data/docs/doc/FalseClass.html +3 -3
- data/docs/doc/GLI/Commands/Help.html +5 -5
- data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +3 -3
- data/docs/doc/GLI/Commands.html +3 -3
- data/docs/doc/GLI.html +3 -3
- data/docs/doc/Hash.html +4 -4
- data/docs/doc/Numeric.html +3 -3
- data/docs/doc/Object.html +3 -3
- data/docs/doc/PhraseParser/Operator.html +3 -3
- data/docs/doc/PhraseParser/PhraseClause.html +3 -3
- data/docs/doc/PhraseParser/Query.html +3 -3
- data/docs/doc/PhraseParser/QueryParser.html +3 -3
- data/docs/doc/PhraseParser/QueryTransformer.html +3 -3
- data/docs/doc/PhraseParser/TermClause.html +3 -3
- data/docs/doc/PhraseParser.html +3 -3
- data/docs/doc/Status.html +3 -3
- data/docs/doc/String.html +51 -5
- data/docs/doc/Symbol.html +3 -3
- data/docs/doc/Time.html +3 -3
- data/docs/doc/TrueClass.html +3 -3
- data/docs/doc/_index.html +4 -4
- data/docs/doc/class_list.html +6 -3
- data/docs/doc/css/full_list.css +3 -3
- data/docs/doc/css/style.css +6 -0
- data/docs/doc/file.README.html +3 -3
- data/docs/doc/file_list.html +5 -2
- data/docs/doc/frames.html +1 -1
- data/docs/doc/index.html +3 -3
- data/docs/doc/js/app.js +294 -264
- data/docs/doc/js/full_list.js +30 -4
- data/docs/doc/method_list.html +443 -392
- data/docs/doc/top-level-namespace.html +3 -3
- data/doing.gemspec +2 -0
- data/doing.rdoc +1 -1
- data/example_plugin.rb +1 -4
- data/lib/doing/add_options.rb +2 -2
- data/lib/doing/array/cleanup.rb +2 -0
- data/lib/doing/array/nested_hash.rb +2 -0
- data/lib/doing/boolean_term_parser.rb +3 -3
- data/lib/doing/changelog/changes.rb +4 -5
- data/lib/doing/changelog/version.rb +8 -11
- data/lib/doing/chronify/array.rb +4 -4
- data/lib/doing/chronify/string.rb +5 -4
- data/lib/doing/cli_status.rb +7 -2
- data/lib/doing/colors.rb +93 -51
- data/lib/doing/completion/bash_completion.rb +36 -39
- data/lib/doing/completion/completion_string.rb +2 -1
- data/lib/doing/completion/fig_completion.rb +33 -33
- data/lib/doing/completion/fish_completion.rb +22 -23
- data/lib/doing/completion/zsh_completion.rb +5 -5
- data/lib/doing/completion.rb +7 -4
- data/lib/doing/configuration.rb +21 -13
- data/lib/doing/errors.rb +1 -4
- data/lib/doing/good.rb +1 -1
- data/lib/doing/hash.rb +4 -4
- data/lib/doing/help_monkey_patch.rb +1 -1
- data/lib/doing/hooks.rb +6 -2
- data/lib/doing/item/dates.rb +3 -1
- data/lib/doing/item/query.rb +10 -10
- data/lib/doing/item/state.rb +2 -0
- data/lib/doing/logger.rb +113 -45
- data/lib/doing/markdown_document_listener.rb +25 -25
- data/lib/doing/normalize.rb +1 -1
- data/lib/doing/pager.rb +73 -29
- data/lib/doing/plugin_manager.rb +4 -5
- data/lib/doing/plugins/export/byday.rb +1 -1
- data/lib/doing/plugins/export/dayone_export.rb +28 -27
- data/lib/doing/plugins/export/doing_export.rb +1 -1
- data/lib/doing/plugins/export/html_export.rb +3 -3
- data/lib/doing/plugins/export/json_export.rb +4 -5
- data/lib/doing/plugins/export/markdown_export.rb +10 -2
- data/lib/doing/plugins/export/taskpaper_export.rb +1 -0
- data/lib/doing/plugins/export/template_export.rb +110 -107
- data/lib/doing/plugins/import/calendar_import.rb +1 -1
- data/lib/doing/plugins/import/doing_import.rb +2 -2
- data/lib/doing/plugins/import/timing_import.rb +3 -3
- data/lib/doing/prompt/choose.rb +5 -6
- data/lib/doing/prompt/fzf.rb +3 -2
- data/lib/doing/prompt/input.rb +7 -6
- data/lib/doing/prompt/yn.rb +9 -11
- data/lib/doing/string/tags.rb +7 -4
- data/lib/doing/string/transform.rb +15 -10
- data/lib/doing/string/truncate.rb +1 -0
- data/lib/doing/string/url.rb +1 -1
- data/lib/doing/template_string.rb +13 -9
- data/lib/doing/time.rb +4 -2
- data/lib/doing/util.rb +12 -11
- data/lib/doing/util_backup.rb +29 -26
- data/lib/doing/version.rb +3 -1
- data/lib/doing/wwid/display.rb +182 -151
- data/lib/doing/wwid/editor.rb +13 -12
- data/lib/doing/wwid/filetools.rb +13 -11
- data/lib/doing/wwid/filter.rb +41 -40
- data/lib/doing/wwid/guess.rb +6 -8
- data/lib/doing/wwid/interactive.rb +9 -9
- data/lib/doing/wwid/modify.rb +53 -53
- data/lib/doing/wwid/timers.rb +4 -5
- data/lib/doing/wwid/wwid.rb +0 -0
- data/lib/doing/wwid/wwidutil.rb +8 -10
- data/lib/examples/commands/wiki.rb +2 -0
- data/lib/examples/plugins/capture_thing_import.rb +1 -1
- data/lib/examples/plugins/say_export.rb +1 -2
- data/lib/examples/plugins/wiki_export/wiki_export.rb +3 -4
- data/lib/helpers/fzf/test/test_go.rb +5 -5
- data/lib/helpers/threaded_tests.rb +20 -20
- data/lib/helpers/threaded_tests_string.rb +2 -0
- data/rdoc_to_mmd.rb +5 -4
- data/rdocfixer.rb +1 -2
- data/scripts/deploy.rb +3 -4
- data/scripts/generate_bash_completions.rb +40 -43
- data/scripts/generate_fish_completions.rb +17 -15
- data/scripts/generate_zsh_completions.rb +9 -7
- data/scripts/setting_replace.rb +1 -0
- data/scripts/sort_commands.rb +4 -2
- data/yard_templates/default/method_details/setup.rb +3 -1
- 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
|
|
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
|
-
|
|
29
|
-
pattern =
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
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!(
|
|
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(.*?)$/,
|
|
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!(
|
|
39
|
-
input.gsub!(
|
|
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
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(
|
|
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
|
|
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,
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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",
|
|
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,
|
|
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,
|
|
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
|
-
|
|
155
|
-
parse_options(data[:command_options]).each do |option|
|
|
156
|
-
next if option.nil?
|
|
155
|
+
next unless data[:command_options]
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
164
|
-
|
|
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",
|
|
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
|
|
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,
|
|
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,
|
|
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",
|
|
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
|
|
data/scripts/setting_replace.rb
CHANGED
data/scripts/sort_commands.rb
CHANGED
|
@@ -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 =
|
|
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('')
|
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.
|
|
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
|