doing 2.1.39 → 2.1.42
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/.yardopts +1 -1
- data/CHANGELOG.md +67 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +4 -4
- data/bin/commands/again.rb +1 -3
- data/bin/commands/changes.rb +50 -34
- data/bin/commands/commands.rb +77 -52
- data/bin/commands/commands_accepting.rb +57 -53
- data/bin/commands/config.rb +45 -36
- data/bin/commands/done.rb +1 -18
- data/bin/commands/finish.rb +90 -59
- data/bin/commands/flag.rb +5 -1
- data/bin/commands/grep.rb +3 -14
- data/bin/commands/last.rb +2 -8
- data/bin/commands/meanwhile.rb +13 -6
- data/bin/commands/now.rb +151 -107
- data/bin/commands/on.rb +8 -18
- data/bin/commands/recent.rb +2 -8
- data/bin/commands/reset.rb +24 -1
- data/bin/commands/select.rb +1 -1
- data/bin/commands/show.rb +6 -17
- data/bin/commands/since.rb +1 -12
- data/bin/commands/tag_dir.rb +49 -15
- data/bin/commands/today.rb +2 -13
- data/bin/commands/undo.rb +4 -6
- data/bin/commands/view.rb +1 -1
- data/bin/commands/yesterday.rb +2 -13
- data/bin/doing +15 -8
- data/{Dockerfile → docker/Dockerfile} +3 -1
- data/{Dockerfile-2.6 → docker/Dockerfile-2.6} +2 -2
- data/{Dockerfile-2.7 → docker/Dockerfile-2.7} +2 -2
- data/{Dockerfile-3.0 → docker/Dockerfile-3.0} +2 -2
- data/{bash_profile → docker/bash_profile} +0 -0
- data/{inputrc → docker/inputrc} +0 -0
- data/docs/doc/Array.html +85 -2
- data/docs/doc/BooleanTermParser/Clause.html +1 -1
- data/docs/doc/BooleanTermParser/Operator.html +1 -1
- data/docs/doc/BooleanTermParser/Query.html +1 -1
- data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
- data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
- data/docs/doc/BooleanTermParser.html +1 -1
- data/docs/doc/Doing/ArrayNestedHash.html +198 -0
- data/docs/doc/Doing/ArrayTags.html +424 -0
- data/docs/doc/Doing/CSVExport.html +266 -0
- data/docs/doc/Doing/CalendarImport.html +232 -0
- data/docs/doc/Doing/Change.html +617 -0
- data/docs/doc/Doing/Changes.html +468 -0
- data/docs/doc/Doing/ChronifyArray.html +347 -0
- data/docs/doc/Doing/ChronifyNumeric.html +271 -0
- data/docs/doc/Doing/ChronifyString.html +682 -0
- data/docs/doc/Doing/Color.html +167 -21
- data/docs/doc/Doing/Completion/BashCompletions.html +445 -0
- data/docs/doc/Doing/Completion/FishCompletions.html +445 -0
- data/docs/doc/Doing/Completion/StringUtils.html +229 -0
- data/docs/doc/Doing/Completion/ZshCompletions.html +445 -0
- data/docs/doc/Doing/Completion.html +17 -3
- data/docs/doc/Doing/Configuration.html +3 -2
- data/docs/doc/Doing/DayOneRenderer.html +383 -0
- data/docs/doc/Doing/DayoneExport.html +290 -0
- data/docs/doc/Doing/DoingImport.html +391 -0
- data/docs/doc/Doing/Entry.html +381 -0
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +7 -3
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +7 -3
- data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
- data/docs/doc/Doing/Errors/EmptyInput.html +10 -2
- data/docs/doc/Doing/Errors/HistoryLimitError.html +194 -0
- data/docs/doc/Doing/Errors/InvalidPlugin.html +194 -0
- data/docs/doc/Doing/Errors/MissingBackupFile.html +194 -0
- data/docs/doc/Doing/Errors/NoResults.html +10 -2
- data/docs/doc/Doing/Errors/PluginException.html +1 -1
- data/docs/doc/Doing/Errors/UserCancelled.html +10 -2
- data/docs/doc/Doing/Errors/WrongCommand.html +10 -2
- data/docs/doc/Doing/Errors.html +9 -9
- data/docs/doc/Doing/HTMLExport.html +256 -0
- data/docs/doc/Doing/Hooks.html +1 -1
- data/docs/doc/Doing/Item.html +179 -1660
- data/docs/doc/Doing/ItemDates.html +564 -0
- data/docs/doc/Doing/ItemQuery.html +614 -0
- data/docs/doc/Doing/ItemState.html +387 -0
- data/docs/doc/Doing/ItemTags.html +498 -0
- data/docs/doc/Doing/Items.html +581 -15
- data/docs/doc/Doing/JSONExport.html +222 -0
- data/docs/doc/Doing/Logger.html +1 -1
- data/docs/doc/Doing/MarkdownExport.html +266 -0
- data/docs/doc/Doing/MarkdownRenderer.html +383 -0
- data/docs/doc/Doing/Note.html +18 -4
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +181 -76
- data/docs/doc/Doing/Prompt.html +32 -683
- data/docs/doc/Doing/PromptChoose.html +484 -0
- data/docs/doc/Doing/PromptFZF.html +391 -0
- data/docs/doc/Doing/PromptInput.html +572 -0
- data/docs/doc/Doing/PromptSTD.html +293 -0
- data/docs/doc/Doing/PromptYN.html +237 -0
- data/docs/doc/Doing/Section.html +58 -2
- data/docs/doc/Doing/StringHighlight.html +533 -0
- data/docs/doc/Doing/StringNormalize.html +929 -0
- data/docs/doc/Doing/StringQuery.html +725 -0
- data/docs/doc/Doing/StringTags.html +884 -0
- data/docs/doc/Doing/StringTransform.html +599 -0
- data/docs/doc/Doing/StringTruncate.html +448 -0
- data/docs/doc/Doing/StringURL.html +409 -0
- data/docs/doc/Doing/SymbolNormalize.html +341 -0
- data/docs/doc/Doing/TaskPaperExport.html +222 -0
- data/docs/doc/Doing/TemplateExport.html +249 -0
- data/docs/doc/Doing/TemplateString.html +102 -3
- data/docs/doc/Doing/TimingImport.html +285 -0
- data/docs/doc/Doing/Types.html +1 -1
- data/docs/doc/Doing/Util/Backup.html +11 -163
- data/docs/doc/Doing/Util.html +67 -10
- data/docs/doc/Doing/Version.html +523 -0
- data/docs/doc/Doing/WWID/WWIDUtil.html +510 -0
- data/docs/doc/Doing/WWID.html +476 -139
- data/docs/doc/Doing/WWIDDisplay.html +865 -0
- data/docs/doc/Doing/WWIDEditor.html +466 -0
- data/docs/doc/Doing/WWIDFileTools.html +359 -0
- data/docs/doc/Doing/WWIDFilter.html +466 -0
- data/docs/doc/Doing/WWIDGuess.html +299 -0
- data/docs/doc/Doing/WWIDInteractive.html +752 -0
- data/docs/doc/Doing/WWIDModify.html +1078 -0
- data/docs/doc/Doing/WWIDTags.html +302 -0
- data/docs/doc/Doing/WWIDTimers.html +359 -0
- data/docs/doc/Doing/WWIDUtil.html +510 -0
- data/docs/doc/Doing.html +9 -6
- data/docs/doc/FalseClass.html +1 -1
- data/docs/doc/GLI/Commands/Help.html +1 -1
- data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
- data/docs/doc/GLI/Commands.html +1 -1
- data/docs/doc/GLI.html +1 -1
- data/docs/doc/Hash.html +1 -1
- data/docs/doc/Numeric.html +23 -78
- data/docs/doc/Object.html +1 -1
- data/docs/doc/PhraseParser/Operator.html +1 -1
- data/docs/doc/PhraseParser/PhraseClause.html +1 -1
- data/docs/doc/PhraseParser/Query.html +1 -1
- data/docs/doc/PhraseParser/QueryParser.html +1 -1
- data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
- data/docs/doc/PhraseParser/TermClause.html +1 -1
- data/docs/doc/PhraseParser.html +1 -1
- data/docs/doc/Status.html +1 -1
- data/docs/doc/String.html +58 -633
- data/docs/doc/Symbol.html +9 -224
- data/docs/doc/Time.html +119 -13
- data/docs/doc/TrueClass.html +1 -1
- data/docs/doc/_index.html +348 -4
- data/docs/doc/class_list.html +1 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/method_list.html +1904 -592
- data/docs/doc/top-level-namespace.html +12 -4
- data/docs/index.md +1 -1
- data/doing.rdoc +67 -15
- data/lib/completion/_doing.zsh +6 -6
- data/lib/completion/doing.bash +10 -10
- data/lib/completion/doing.fish +10 -3
- data/lib/doing/add_options.rb +39 -1
- data/lib/doing/array/array.rb +18 -12
- data/lib/doing/array/cleanup.rb +31 -0
- data/lib/doing/array/nested_hash.rb +1 -1
- data/lib/doing/array/tags.rb +6 -5
- data/lib/doing/changelog/changelog.rb +6 -0
- data/lib/doing/chronify/array.rb +65 -25
- data/lib/doing/chronify/chronify.rb +12 -0
- data/lib/doing/chronify/numeric.rb +3 -2
- data/lib/doing/chronify/string.rb +1 -1
- data/lib/doing/colors.rb +77 -30
- data/lib/doing/completion/completion_string.rb +25 -0
- data/lib/doing/completion.rb +4 -5
- data/lib/doing/configuration.rb +7 -3
- data/lib/doing/errors.rb +51 -35
- data/lib/doing/good.rb +8 -0
- data/lib/doing/hooks.rb +3 -3
- data/lib/doing/item/dates.rb +112 -0
- data/lib/doing/item/item.rb +128 -0
- data/lib/doing/{item.rb → item/query.rb} +2 -353
- data/lib/doing/item/state.rb +59 -0
- data/lib/doing/item/tags.rb +87 -0
- data/lib/doing/items/filter.rb +67 -0
- data/lib/doing/items/items.rb +57 -0
- data/lib/doing/items/modify.rb +36 -0
- data/lib/doing/items/sections.rb +83 -0
- data/lib/doing/items/util.rb +74 -0
- data/lib/doing/normalize.rb +10 -2
- data/lib/doing/note.rb +1 -1
- data/lib/doing/pager.rb +9 -3
- data/lib/doing/plugin_manager.rb +33 -8
- data/lib/doing/plugins/export/markdown_export.rb +4 -2
- data/lib/doing/plugins/export/template_export.rb +4 -4
- data/lib/doing/plugins/import/cal_to_json.scpt +0 -0
- data/lib/doing/plugins/import/doing_import.rb +1 -1
- data/lib/doing/prompt/choose.rb +118 -0
- data/lib/doing/prompt/fzf.rb +84 -0
- data/lib/doing/prompt/input.rb +129 -0
- data/lib/doing/prompt/prompt.rb +41 -0
- data/lib/doing/prompt/std.rb +32 -0
- data/lib/doing/prompt/yn.rb +64 -0
- data/lib/doing/section.rb +4 -0
- data/lib/doing/string/highlight.rb +1 -1
- data/lib/doing/string/query.rb +1 -1
- data/lib/doing/string/string.rb +18 -7
- data/lib/doing/string/tags.rb +14 -3
- data/lib/doing/string/transform.rb +7 -1
- data/lib/doing/string/truncate.rb +1 -1
- data/lib/doing/string/url.rb +1 -1
- data/lib/doing/time.rb +19 -1
- data/lib/doing/util.rb +12 -6
- data/lib/doing/util_backup.rb +62 -57
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid/display.rb +396 -0
- data/lib/doing/wwid/editor.rb +214 -0
- data/lib/doing/wwid/filetools.rb +183 -0
- data/lib/doing/wwid/filter.rb +226 -0
- data/lib/doing/wwid/guess.rb +85 -0
- data/lib/doing/wwid/interactive.rb +377 -0
- data/lib/doing/wwid/modify.rb +617 -0
- data/lib/doing/wwid/tags.rb +51 -0
- data/lib/doing/wwid/timers.rb +342 -0
- data/lib/doing/wwid/wwid.rb +121 -0
- data/lib/doing/wwid/wwidutil.rb +101 -0
- data/lib/doing.rb +7 -7
- data/lib/helpers/threaded_tests.rb +1 -0
- metadata +94 -14
- data/lib/doing/changelog.rb +0 -6
- data/lib/doing/completion/string.rb +0 -17
- data/lib/doing/items.rb +0 -196
- data/lib/doing/prompt.rb +0 -330
- data/lib/doing/wwid.rb +0 -2398
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8021e76952eb60e4eb68c5aa013f558e7e9e5db454bad792c1ae7e5cc495e24c
|
|
4
|
+
data.tar.gz: 5eda874992b4f9648c421afdc4429963f2614d08aabba8fb338d4d27c353e258
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37ce93cc4868cbb5565f18b8cd2a77d61099f9692c5b6bcaacdf9329876faa4bc9ff240adc29ea2f8e4cff76adbadc697f583131dfcdb61379dc998a91d40de4
|
|
7
|
+
data.tar.gz: 06d59cd04607005a65f166701873107a8d4817986007940489dfda3247d97d567a4072d62eb05687f50e1ba93eb6341f1db8f5a317df948836fa56945270a8fa
|
data/.yardopts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
--output-dir docs/doc --markup-provider=redcarpet --markup=markdown --no-private --exclude=README.md lib/doing
|
|
1
|
+
--output-dir docs/doc --markup-provider=redcarpet --markup=markdown --no-private --exclude=README.md lib/doing/**/*.rb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,70 @@
|
|
|
1
|
+
### 2.1.42
|
|
2
|
+
|
|
3
|
+
2022-03-17 09:38
|
|
4
|
+
|
|
5
|
+
#### NEW
|
|
6
|
+
|
|
7
|
+
- Config option `editors.pager` allows you to force a pager (ignore env settings)
|
|
8
|
+
|
|
9
|
+
#### IMPROVED
|
|
10
|
+
|
|
11
|
+
- Change pager preference order to $PAGER, less -Xr, $GIT_PAGER
|
|
12
|
+
- Remove `bat` from pager options as it just falls back to `less -Xr` anyway
|
|
13
|
+
- Using CTRL-C when entring a note interactively won't cancel the whole operation, just the note
|
|
14
|
+
|
|
15
|
+
#### FIXED
|
|
16
|
+
|
|
17
|
+
- Add delay between `doing select --editor` and opening the editor, fixes some TTY echo issues
|
|
18
|
+
- If `doing last --editor` has no changes, exit gracefully
|
|
19
|
+
- Trigger pre/post_write hooks when using undo/redo
|
|
20
|
+
- `doing config set` issues with keys that default to nil
|
|
21
|
+
- Notification for `doing config set --remove` missing last element of key path
|
|
22
|
+
|
|
23
|
+
### 2.1.41
|
|
24
|
+
|
|
25
|
+
2022-03-16 09:29
|
|
26
|
+
|
|
27
|
+
#### NEW
|
|
28
|
+
|
|
29
|
+
- Filter methods available to plugins on Items collection - #in_section, #search, #tagged, #between_dates
|
|
30
|
+
|
|
31
|
+
#### IMPROVED
|
|
32
|
+
|
|
33
|
+
- Better comparison methods for Items and Sections
|
|
34
|
+
- `doing tag_dir -r TAG` can remove an indivudal tag from default_tags (--clear removes all)
|
|
35
|
+
- `doing tag_dir` accepts `--editor` to edit tag list in default editor
|
|
36
|
+
- `doing tag_dir` without arguments requests input via readline
|
|
37
|
+
- Use `.txt` instead of `.md` for editor temp file to avoid incorrect syntax higlighting in editor
|
|
38
|
+
- Further API documentation
|
|
39
|
+
|
|
40
|
+
#### FIXED
|
|
41
|
+
|
|
42
|
+
- Security warnings related to regular expressions
|
|
43
|
+
- Items.diff method returning too many changes
|
|
44
|
+
|
|
45
|
+
### 2.1.40
|
|
46
|
+
|
|
47
|
+
2022-03-14 19:56
|
|
48
|
+
|
|
49
|
+
#### NEW
|
|
50
|
+
|
|
51
|
+
- `doing finish` accepts `--from` ranges to update both start and finish dates
|
|
52
|
+
- `doing finish` allows `--back` and `--took` to be used together
|
|
53
|
+
- `doing finish` allows `--search` and `--tag` to be used together
|
|
54
|
+
- `doing finish --from 'DATE to DATE'` allows you to set a new start and end time with a single range string
|
|
55
|
+
- `doing reset --from 'DATE to DATE'` allows you to reset an entry's start time and update or add @done time
|
|
56
|
+
- `doing reset` accepts a `--took Xm` flag to change the finish time
|
|
57
|
+
- `--output FORMAT` option for all display commands, including last, recent and today
|
|
58
|
+
|
|
59
|
+
#### IMPROVED
|
|
60
|
+
|
|
61
|
+
- Code refactoring, split up WWID class
|
|
62
|
+
- Better diff method available to hooks to see what changed
|
|
63
|
+
|
|
64
|
+
#### FIXED
|
|
65
|
+
|
|
66
|
+
- Search highlighting was being skipped in all cases
|
|
67
|
+
|
|
1
68
|
### 2.1.39
|
|
2
69
|
|
|
3
70
|
2022-03-13 04:32
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -8,7 +8,7 @@ _If you're one of the rare people like me who find this useful, feel free to
|
|
|
8
8
|
|
|
9
9
|
<!--README-->
|
|
10
10
|
|
|
11
|
-
The current version of `doing` is <!--VER-->2.1.
|
|
11
|
+
The current version of `doing` is <!--VER-->2.1.41<!--END VER-->.
|
|
12
12
|
|
|
13
13
|
Find all of the documentation in the [doing wiki][wiki].
|
|
14
14
|
|
data/Rakefile
CHANGED
|
@@ -71,16 +71,16 @@ task :dockertest, :version, :login do |_, args|
|
|
|
71
71
|
Process.exit 0
|
|
72
72
|
when /^3/
|
|
73
73
|
img = 'doingtest3'
|
|
74
|
-
file = 'Dockerfile-3.0'
|
|
74
|
+
file = 'docker/Dockerfile-3.0'
|
|
75
75
|
when /6$/
|
|
76
76
|
img = 'doingtest26'
|
|
77
|
-
file = 'Dockerfile-2.6'
|
|
77
|
+
file = 'docker/Dockerfile-2.6'
|
|
78
78
|
when /(^2|7$)/
|
|
79
79
|
img = 'doingtest27'
|
|
80
|
-
file = 'Dockerfile-2.7'
|
|
80
|
+
file = 'docker/Dockerfile-2.7'
|
|
81
81
|
else
|
|
82
82
|
img = 'doingtest'
|
|
83
|
-
file = 'Dockerfile'
|
|
83
|
+
file = 'docker/Dockerfile'
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
puts `docker build . --file #{file} -t #{img}`
|
data/bin/commands/again.rb
CHANGED
|
@@ -33,9 +33,7 @@ command %i[again resume] do |c|
|
|
|
33
33
|
c.action do |_global_options, options, _args|
|
|
34
34
|
options[:fuzzy] = false
|
|
35
35
|
|
|
36
|
-
if options[:search]
|
|
37
|
-
options[:search] = options[:exact] ? options[:search].sub(/^'?/, "'") : options[:search]
|
|
38
|
-
end
|
|
36
|
+
options[:search] = options[:search].sub(/^'?/, "'") if options[:search] && options[:exact]
|
|
39
37
|
|
|
40
38
|
if options[:back]
|
|
41
39
|
options[:date] = options[:back]
|
data/bin/commands/changes.rb
CHANGED
|
@@ -14,52 +14,68 @@ MARKDOWN_THEME = {
|
|
|
14
14
|
comment: :bright_black
|
|
15
15
|
}.deep_freeze
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
module Doing
|
|
18
|
+
# changes command methods
|
|
19
|
+
class ChangesCommand
|
|
20
|
+
CHANGE_RX = /^(?:(?:(?:[<>=]+|p(?:rior)|b(?:efore)|o(?:lder)|s(?:ince)|a(?:fter)|n(?:ewer))? *[0-9.*?]{1,10} *)+|(?:[\d.]+ *(?:-|to)+ *[0-9.]{1,10}))$/
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
def add_options(cmd)
|
|
23
|
+
cmd.desc 'Display all versions'
|
|
24
|
+
cmd.switch %i[a all], default_value: false, negatable: false
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
cmd.desc %(Look up a specific version. Specify versions as "MAJ.MIN.PATCH", MIN
|
|
27
|
+
and PATCH are optional. Use > or < to see all changes since or prior
|
|
28
|
+
to a version. Wildcards (*?) accepted unless using < or >.)
|
|
29
|
+
cmd.arg_name 'VERSION'
|
|
30
|
+
cmd.flag %i[l lookup], must_match: CHANGE_RX
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
c.arg_name 'VERSION'
|
|
32
|
-
c.flag %i[l lookup], must_match: CHANGE_RX
|
|
32
|
+
cmd.desc %(Show changelogs matching search terms (uses pattern-based searching).
|
|
33
|
+
Add slashes to search with regular expressions, e.g. `--search "/output.*flag/"`)
|
|
34
|
+
cmd.flag %i[s search]
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
cmd.desc 'Sort order (asc/desc)'
|
|
37
|
+
cmd.arg_name 'ORDER'
|
|
38
|
+
cmd.flag %i[sort], must_match: REGEX_SORT_ORDER, default_value: :desc, type: OrderSymbol
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
c.flag %i[sort], must_match: REGEX_SORT_ORDER, default_value: :desc, type: OrderSymbol
|
|
40
|
+
cmd.desc 'Only output changes, no version numbers, headers, or dates'
|
|
41
|
+
cmd.switch %i[C changes], default_value: false, negatable: false
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
cmd.desc 'Output raw Markdown'
|
|
44
|
+
cmd.switch %i[m md markdown], default_value: false, negatable: false
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
cmd.desc 'Force rendered output'
|
|
47
|
+
cmd.switch %i[render], default_value: false, negatable: false
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
cmd.desc 'Open changelog in interactive viewer'
|
|
50
|
+
cmd.switch %i[i interactive], default_value: false, negatable: false
|
|
51
|
+
end
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
def add_examples(cmd)
|
|
54
|
+
cmd.example 'doing changes', desc: 'View changes in the current version'
|
|
55
|
+
cmd.example 'doing changes --all', desc: 'See the entire changelog'
|
|
56
|
+
cmd.example 'doing changes --lookup 2.0.21', desc: 'See changes from version 2.0.21'
|
|
57
|
+
cmd.example 'doing changes --lookup "> 2.1"', desc: 'See all changes since 2.1.0'
|
|
58
|
+
cmd.example 'doing changes --search "tags +bool"', desc: 'See all changes containing "tags" and "bool"'
|
|
59
|
+
cmd.example 'doing changes -l "> 2.1" -s "pattern"', desc: 'Lookup and search can be combined'
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
desc 'List recent changes in Doing'
|
|
65
|
+
long_desc %(Display a formatted list of changes in recent versions.
|
|
53
66
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
c
|
|
59
|
-
c
|
|
67
|
+
Without flags, displays only the most recent version.
|
|
68
|
+
Use --lookup or --all for history.)
|
|
69
|
+
command %i[changes changelog] do |c|
|
|
70
|
+
cmd = Doing::ChangesCommand.new
|
|
71
|
+
cmd.add_options(c)
|
|
72
|
+
cmd.add_examples(c)
|
|
60
73
|
|
|
61
74
|
c.action do |_global_options, options, _args|
|
|
62
|
-
cl = Doing::Changes.new(lookup: options[:lookup],
|
|
75
|
+
cl = Doing::Changes.new(lookup: options[:lookup],
|
|
76
|
+
search: options[:search],
|
|
77
|
+
changes: options[:changes],
|
|
78
|
+
sort: options[:sort])
|
|
63
79
|
|
|
64
80
|
if options[:interactive]
|
|
65
81
|
cl.interactive
|
data/bin/commands/commands.rb
CHANGED
|
@@ -1,37 +1,71 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
module Doing
|
|
4
|
+
# commands command methods
|
|
5
|
+
class CommandsCommand
|
|
6
|
+
def add_examples(cmd)
|
|
7
|
+
cmd.example 'doing commands add', desc: 'Get a menu of available commands'
|
|
8
|
+
cmd.example 'doing commands add COMMAND', desc: 'Specify a command to enable'
|
|
9
|
+
cmd.example 'doing commands remove COMMAND', desc: 'Specify a command to disable'
|
|
10
|
+
end
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
def remove_command(args)
|
|
13
|
+
available = Dir.glob(File.join(File.dirname(__FILE__), '*.rb')).map { |cmd| File.basename(cmd, '.rb') }
|
|
14
|
+
cfg = Doing.settings
|
|
15
|
+
custom_dir = Doing.setting('plugins.command_path')
|
|
16
|
+
custom_commands = Dir.glob(File.join(File.expand_path(custom_dir), '*.rb'))
|
|
17
|
+
available.concat(custom_commands.map { |cmd| File.basename(cmd, '.rb') })
|
|
18
|
+
disabled = Doing.setting('disabled_commands')
|
|
19
|
+
disabled.each { |cmd| available.delete(cmd) }
|
|
20
|
+
to_disable = if args.good?
|
|
21
|
+
args
|
|
22
|
+
else
|
|
23
|
+
Prompt.choose_from(available,
|
|
24
|
+
prompt: 'Select commands to enable',
|
|
25
|
+
multiple: true,
|
|
26
|
+
sorted: true)
|
|
27
|
+
end
|
|
28
|
+
raise UserCancelled unless to_disable.good?
|
|
11
29
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
30
|
+
to_disable = to_disable.strip.split("\n") if to_disable.is_a?(String)
|
|
31
|
+
|
|
32
|
+
to_disable.each do |cmd|
|
|
33
|
+
default_command = File.join(File.dirname(__FILE__), "#{cmd}.rb")
|
|
34
|
+
custom_command = File.join(File.expand_path(custom_dir), "#{cmd}.rb")
|
|
35
|
+
unless File.exist?(default_command) || File.exist?(custom_command)
|
|
36
|
+
raise InvalidArgument, "Command #{cmd} not found"
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
raise InvalidArgument, "Command #{cmd} is not enabled" unless available.include?(cmd)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
cfg.deep_set(['disabled_commands'], disabled.concat(to_disable))
|
|
44
|
+
|
|
45
|
+
Util.write_to_file(Doing.config.config_file, YAML.dump(cfg), backup: true)
|
|
46
|
+
Doing.logger.warn('Config:', "#{Doing.config.config_file} updated")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def add_command(args)
|
|
18
50
|
cfg = Doing.settings
|
|
19
|
-
custom_dir =
|
|
51
|
+
custom_dir = Doing.setting('plugins.command_path')
|
|
52
|
+
available = Doing.setting('disabled_commands')
|
|
20
53
|
|
|
21
|
-
available = cfg['disabled_commands']
|
|
22
54
|
raise UserCancelled, 'No commands available to enable' unless args.good? || available.good?
|
|
23
55
|
|
|
24
56
|
to_enable = if args.good?
|
|
25
57
|
args
|
|
26
58
|
else
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
59
|
+
Prompt.choose_from(available,
|
|
60
|
+
prompt: 'Select commands to enable',
|
|
61
|
+
multiple: true,
|
|
62
|
+
sorted: true)
|
|
31
63
|
end
|
|
32
|
-
raise UserCancelled unless to_enable
|
|
64
|
+
raise UserCancelled unless to_enable.good?
|
|
33
65
|
|
|
34
|
-
to_enable.strip.split("\n")
|
|
66
|
+
to_enable = to_enable.strip.split("\n") if to_enable.is_a?(String)
|
|
67
|
+
|
|
68
|
+
to_enable.each do |cmd|
|
|
35
69
|
default_command = File.join(File.dirname(__FILE__), "#{cmd}.rb")
|
|
36
70
|
custom_command = File.join(File.expand_path(custom_dir), "#{cmd}.rb")
|
|
37
71
|
unless File.exist?(default_command) || File.exist?(custom_command)
|
|
@@ -45,45 +79,36 @@ command :commands do |c|
|
|
|
45
79
|
|
|
46
80
|
cfg.deep_set(['disabled_commands'], available)
|
|
47
81
|
|
|
48
|
-
|
|
82
|
+
Util.write_to_file(Doing.config.config_file, YAML.dump(cfg), backup: true)
|
|
49
83
|
Doing.logger.warn('Config:', "#{Doing.config.config_file} updated")
|
|
50
84
|
end
|
|
51
85
|
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# @@commands
|
|
89
|
+
desc 'Enable and disable Doing commands'
|
|
90
|
+
command :commands do |c|
|
|
91
|
+
c.default_command :add
|
|
92
|
+
|
|
93
|
+
cmd = Doing::CommandsCommand.new
|
|
94
|
+
|
|
95
|
+
cmd.add_examples(c)
|
|
96
|
+
|
|
97
|
+
# @@commands.enable
|
|
98
|
+
c.desc 'Enable Doing commands'
|
|
99
|
+
c.long_desc 'Run without arguments to select commands from a list.'
|
|
100
|
+
c.arg_name 'COMMAND [COMMAND...]'
|
|
101
|
+
c.command %i[add enable] do |add|
|
|
102
|
+
add.action do |_global, _options, args|
|
|
103
|
+
cmd.add_command(args)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
52
106
|
|
|
53
107
|
# @@commands.disable
|
|
54
108
|
c.desc 'Disable Doing commands'
|
|
55
109
|
c.command %i[remove disable] do |remove|
|
|
56
110
|
remove.action do |_global, _options, args|
|
|
57
|
-
|
|
58
|
-
cfg = Doing.settings
|
|
59
|
-
custom_dir = cfg.dig('plugins', 'command_path')
|
|
60
|
-
custom_commands = Dir.glob(File.join(File.expand_path(custom_dir), '*.rb'))
|
|
61
|
-
available.concat(custom_commands.map { |cmd| File.basename(cmd, '.rb') })
|
|
62
|
-
disabled = cfg['disabled_commands']
|
|
63
|
-
disabled.each { |cmd| available.delete(cmd) }
|
|
64
|
-
to_disable = if args.good?
|
|
65
|
-
args
|
|
66
|
-
else
|
|
67
|
-
Doing::Prompt.choose_from(available,
|
|
68
|
-
prompt: 'Select commands to enable',
|
|
69
|
-
multiple: true,
|
|
70
|
-
sorted: true).strip.split("\n")
|
|
71
|
-
end
|
|
72
|
-
to_disable.each do |cmd|
|
|
73
|
-
default_command = File.join(File.dirname(__FILE__), "#{cmd}.rb")
|
|
74
|
-
custom_command = File.join(File.expand_path(custom_dir), "#{cmd}.rb")
|
|
75
|
-
unless File.exist?(default_command) || File.exist?(custom_command)
|
|
76
|
-
raise InvalidArgument, "Command #{cmd} not found"
|
|
77
|
-
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
raise InvalidArgument, "Command #{cmd} is not enabled" unless available.include?(cmd)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
cfg.deep_set(['disabled_commands'], disabled.concat(to_disable))
|
|
84
|
-
|
|
85
|
-
Doing::Util.write_to_file(Doing.config.config_file, YAML.dump(cfg), backup: true)
|
|
86
|
-
Doing.logger.warn('Config:', "#{Doing.config.config_file} updated")
|
|
111
|
+
cmd.remove_command(args)
|
|
87
112
|
end
|
|
88
113
|
end
|
|
89
114
|
end
|
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
module Doing
|
|
4
|
+
# commands_accepting command methods
|
|
5
|
+
class CommandsAcceptingCommand
|
|
6
|
+
def flags?(options, args, bool)
|
|
7
|
+
case bool
|
|
8
|
+
when :and
|
|
9
|
+
all_flags?(options, args)
|
|
10
|
+
when :not
|
|
11
|
+
no_flags?(options, args)
|
|
12
|
+
else
|
|
13
|
+
any_flags?(options, args)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def all_flags?(options, args)
|
|
18
|
+
args.each do |arg|
|
|
19
|
+
has_flag = false
|
|
20
|
+
options.flags.merge(options.switches).each do |_, flag|
|
|
21
|
+
if flag.name == arg.to_sym || flag.aliases&.include?(arg.to_sym)
|
|
22
|
+
has_flag = true
|
|
23
|
+
break
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
return false unless has_flag
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def any_flags?(options, args)
|
|
33
|
+
args.each do |option|
|
|
34
|
+
options.flags.merge(options.switches).each do |_, flag|
|
|
35
|
+
return true if flag.name == option.to_sym || flag.aliases&.include?(option.to_sym)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
false
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def no_flags?(options, args)
|
|
43
|
+
args.each do |option|
|
|
44
|
+
options.flags.merge(options.switches).each do |_, flag|
|
|
45
|
+
return false if flag.name == option.to_sym || flag.aliases&.include?(option.to_sym)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
true
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
3
54
|
# @@commands_accepting
|
|
4
55
|
arg_name 'OPTION'
|
|
5
56
|
command :commands_accepting do |c|
|
|
@@ -11,66 +62,19 @@ command :commands_accepting do |c|
|
|
|
11
62
|
default_value: :and,
|
|
12
63
|
type: BooleanSymbol
|
|
13
64
|
|
|
14
|
-
c.action do |
|
|
65
|
+
c.action do |_g, o, a|
|
|
66
|
+
cac = Doing::CommandsAcceptingCommand.new
|
|
15
67
|
cmds = []
|
|
16
|
-
commands.each { |cmd, v| cmds.push(cmd) if
|
|
68
|
+
commands.each { |cmd, v| cmds.push(cmd) if cac.flags?(v, a, o[:bool]) }
|
|
17
69
|
|
|
18
70
|
if o[:column]
|
|
19
71
|
puts cmds.sort
|
|
20
72
|
else
|
|
21
|
-
description =
|
|
22
|
-
description +=
|
|
23
|
-
description +=
|
|
73
|
+
description = 'Commands '
|
|
74
|
+
description += 'not ' if o[:bool] == :not
|
|
75
|
+
description += 'accepting '
|
|
24
76
|
description += a.map { |arg| "--#{arg}" }.join(o[:bool] == :and ? ' and ' : ' or ')
|
|
25
77
|
puts "#{description}: #{cmds.sort.join(', ')}"
|
|
26
78
|
end
|
|
27
79
|
end
|
|
28
|
-
|
|
29
|
-
def has_flags?(options, args, bool)
|
|
30
|
-
case bool
|
|
31
|
-
when :and
|
|
32
|
-
all_flags?(options, args)
|
|
33
|
-
when :not
|
|
34
|
-
no_flags?(options, args)
|
|
35
|
-
else
|
|
36
|
-
any_flags?(options, args)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def all_flags?(options, args)
|
|
41
|
-
args.each do |arg|
|
|
42
|
-
has_flag = false
|
|
43
|
-
options.flags.merge(options.switches).each do |_, flag|
|
|
44
|
-
if flag.name == arg.to_sym || flag.aliases&.include?(arg.to_sym)
|
|
45
|
-
has_flag = true
|
|
46
|
-
break
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
return false unless has_flag
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
true
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def any_flags?(options, args)
|
|
56
|
-
args.each do |option|
|
|
57
|
-
options.flags.merge(options.switches).each do |_, flag|
|
|
58
|
-
return true if flag.name == option.to_sym || flag.aliases&.include?(option.to_sym)
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
false
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def no_flags?(options, args)
|
|
66
|
-
args.each do |option|
|
|
67
|
-
options.flags.merge(options.switches).each do |_, flag|
|
|
68
|
-
return false if flag.name == option.to_sym || flag.aliases&.include?(option.to_sym)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
true
|
|
73
|
-
end
|
|
74
80
|
end
|
|
75
|
-
|
|
76
|
-
|