doing 2.1.27 → 2.1.31pre
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 +1 -0
- data/.yardoc/checksums +11 -10
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +4952 -0
- data/Gemfile.lock +2 -1
- data/README.md +1 -1
- data/bin/commands/again.rb +1 -1
- data/bin/commands/archive.rb +3 -3
- data/bin/commands/cancel.rb +1 -1
- data/bin/commands/changes.rb +32 -18
- data/bin/commands/commands.rb +8 -8
- data/bin/commands/completion.rb +61 -19
- data/bin/commands/config.rb +16 -16
- data/bin/commands/done.rb +1 -1
- data/bin/commands/flag.rb +1 -1
- data/bin/commands/grep.rb +5 -5
- data/bin/commands/last.rb +1 -1
- data/bin/commands/meanwhile.rb +1 -1
- data/bin/commands/now.rb +1 -1
- data/bin/commands/on.rb +1 -1
- data/bin/commands/open.rb +4 -4
- data/bin/commands/recent.rb +4 -4
- data/bin/commands/show.rb +8 -8
- data/bin/commands/since.rb +1 -1
- data/bin/commands/today.rb +1 -1
- data/bin/commands/view.rb +3 -3
- data/bin/commands/yesterday.rb +2 -2
- data/bin/doing +22 -133
- data/docs/doc/Array.html +1 -1
- 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/Color.html +1 -1
- data/docs/doc/Doing/Completion.html +324 -4
- data/docs/doc/Doing/Configuration.html +1 -1
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
- data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
- data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
- data/docs/doc/Doing/Errors/NoResults.html +1 -1
- data/docs/doc/Doing/Errors/PluginException.html +1 -1
- data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
- data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
- data/docs/doc/Doing/Errors.html +1 -1
- data/docs/doc/Doing/Hooks.html +1 -1
- data/docs/doc/Doing/Item.html +125 -1
- data/docs/doc/Doing/Items.html +1 -1
- data/docs/doc/Doing/LogAdapter.html +1 -1
- data/docs/doc/Doing/Note.html +109 -3
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +1 -1
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +1 -1
- data/docs/doc/Doing/Types.html +1 -1
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +6 -6
- data/docs/doc/Doing.html +2 -2
- 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/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 +1 -1
- data/docs/doc/Symbol.html +1 -1
- data/docs/doc/Time.html +1 -1
- data/docs/doc/TrueClass.html +1 -1
- data/docs/doc/_index.html +3 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/method_list.html +337 -241
- data/docs/doc/top-level-namespace.html +105 -1
- data/doing.gemspec +1 -0
- data/doing.rdoc +46 -41
- data/example_plugin.rb +7 -5
- data/lib/completion/_doing.zsh +4 -8
- data/lib/completion/doing.bash +4 -15
- data/lib/completion/doing.fish +6 -9
- data/lib/doing/add_options.rb +117 -0
- data/lib/doing/array/array.rb +16 -0
- data/lib/doing/changelog/change.rb +1 -1
- data/lib/doing/changelog/changes.rb +26 -7
- data/lib/doing/changelog/version.rb +11 -3
- data/lib/doing/completion/bash_completion.rb +12 -51
- data/lib/doing/completion/fish_completion.rb +16 -52
- data/lib/doing/completion/zsh_completion.rb +12 -51
- data/lib/doing/completion.rb +203 -17
- data/lib/doing/configuration.rb +5 -5
- data/lib/doing/item.rb +21 -3
- data/lib/doing/items.rb +5 -5
- data/lib/doing/note.rb +24 -8
- data/lib/doing/plugins/export/dayone_export.rb +8 -6
- data/lib/doing/plugins/export/html_export.rb +4 -4
- data/lib/doing/plugins/export/json_export.rb +19 -20
- data/lib/doing/plugins/export/markdown_export.rb +2 -2
- data/lib/doing/plugins/export/template_export.rb +4 -4
- data/lib/doing/plugins/import/calendar_import.rb +1 -1
- data/lib/doing/plugins/import/doing_import.rb +1 -1
- data/lib/doing/plugins/import/timing_import.rb +1 -1
- data/lib/doing/section.rb +1 -1
- data/lib/doing/string/highlight.rb +3 -4
- data/lib/doing/string/string.rb +8 -0
- data/lib/doing/util.rb +1 -1
- data/lib/doing/util_backup.rb +12 -12
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +75 -76
- data/lib/doing.rb +58 -0
- data/lib/examples/commands/wiki.rb +27 -19
- data/scripts/setting_replace.rb +11 -0
- metadata +26 -4
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
doing (2.1.
|
|
4
|
+
doing (2.1.31pre)
|
|
5
5
|
chronic (~> 0.10, >= 0.10.2)
|
|
6
6
|
deep_merge (~> 1.2, >= 1.2.1)
|
|
7
7
|
gli (~> 2.20, >= 2.20.1)
|
|
@@ -9,6 +9,7 @@ PATH
|
|
|
9
9
|
parslet (~> 2.0, >= 2.0.0)
|
|
10
10
|
plist (~> 3.6, >= 3.6.0)
|
|
11
11
|
safe_yaml (~> 1.0)
|
|
12
|
+
sys-uname (~> 1.2, >= 1.2.2)
|
|
12
13
|
tty-link (~> 0.1, >= 0.1.1)
|
|
13
14
|
tty-markdown (~> 0.7, >= 0.7.0)
|
|
14
15
|
tty-progressbar (~> 0.18, >= 0.18.2)
|
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.30<!--END VER-->.
|
|
12
12
|
|
|
13
13
|
Find all of the documentation in the [doing wiki][wiki].
|
|
14
14
|
|
data/bin/commands/again.rb
CHANGED
|
@@ -39,7 +39,7 @@ command %i[again resume] do |c|
|
|
|
39
39
|
|
|
40
40
|
if options[:back]
|
|
41
41
|
options[:date] = options[:back]
|
|
42
|
-
raise InvalidTimeExpression, 'Unable to parse date string for --back' if date.nil?
|
|
42
|
+
raise InvalidTimeExpression, 'Unable to parse date string for --back' if options[:date].nil?
|
|
43
43
|
|
|
44
44
|
else
|
|
45
45
|
options[:date] = Time.now
|
data/bin/commands/archive.rb
CHANGED
|
@@ -5,9 +5,9 @@ desc 'Move entries between sections'
|
|
|
5
5
|
long_desc %(Argument can be a section name to move all entries from a section,
|
|
6
6
|
or start with an "@" to move entries matching a tag.
|
|
7
7
|
|
|
8
|
-
Default with no argument moves items from the "#{
|
|
8
|
+
Default with no argument moves items from the "#{Doing.setting('current_section')}" section to Archive.)
|
|
9
9
|
arg_name 'SECTION_OR_TAG'
|
|
10
|
-
default_value
|
|
10
|
+
default_value Doing.setting('current_section')
|
|
11
11
|
command %i[archive move] do |c|
|
|
12
12
|
c.example 'doing archive Currently', desc: 'Move all entries in the Currently section to Archive section'
|
|
13
13
|
c.example 'doing archive @done', desc: 'Move all entries tagged @done to Archive'
|
|
@@ -33,7 +33,7 @@ command %i[archive move] do |c|
|
|
|
33
33
|
c.action do |_global_options, options, args|
|
|
34
34
|
options[:fuzzy] = false
|
|
35
35
|
section, tags = if args.empty?
|
|
36
|
-
[
|
|
36
|
+
[Doing.setting('current_section'), []]
|
|
37
37
|
elsif args[0] =~ /^all/i
|
|
38
38
|
['all', []]
|
|
39
39
|
elsif args[0] =~ /^@\S+/
|
data/bin/commands/cancel.rb
CHANGED
|
@@ -30,7 +30,7 @@ command :cancel do |c|
|
|
|
30
30
|
options[:section] = if options[:section]
|
|
31
31
|
@wwid.guess_section(options[:section]) || options[:section].cap_first
|
|
32
32
|
else
|
|
33
|
-
|
|
33
|
+
Doing.setting('current_section')
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
raise InvalidArgument, 'Only one argument allowed' if args.length > 1
|
data/bin/commands/changes.rb
CHANGED
|
@@ -14,7 +14,7 @@ MARKDOWN_THEME = {
|
|
|
14
14
|
comment: :bright_black
|
|
15
15
|
}.deep_freeze
|
|
16
16
|
|
|
17
|
-
CHANGE_RX = /^(?:(?:(?:[<>=]
|
|
17
|
+
CHANGE_RX = /^(?:(?:(?:[<>=]+|p(?:rior)|b(?:efore)|o(?:lder)|s(?:ince)|a(?:fter)|n(?:ewer))? *[0-9.*?]+ *)+|(?:[\d.]+ *(?:-|to)+ *[0-9.]+))$/
|
|
18
18
|
|
|
19
19
|
desc 'List recent changes in Doing'
|
|
20
20
|
long_desc %(Display a formatted list of changes in recent versions.
|
|
@@ -27,7 +27,7 @@ command %i[changes changelog] do |c|
|
|
|
27
27
|
|
|
28
28
|
c.desc %(Look up a specific version. Specify versions as "MAJ.MIN.PATCH", MIN
|
|
29
29
|
and PATCH are optional. Use > or < to see all changes since or prior
|
|
30
|
-
to a version.)
|
|
30
|
+
to a version. Wildcards (*?) accepted unless using < or >.)
|
|
31
31
|
c.arg_name 'VERSION'
|
|
32
32
|
c.flag %i[l lookup], must_match: CHANGE_RX
|
|
33
33
|
|
|
@@ -35,12 +35,22 @@ command %i[changes changelog] do |c|
|
|
|
35
35
|
Add slashes to search with regular expressions, e.g. `--search "/output.*flag/"`)
|
|
36
36
|
c.flag %i[s search]
|
|
37
37
|
|
|
38
|
+
c.desc 'Sort order (asc/desc)'
|
|
39
|
+
c.arg_name 'ORDER'
|
|
40
|
+
c.flag %i[sort], must_match: REGEX_SORT_ORDER, default_value: :desc, type: OrderSymbol
|
|
41
|
+
|
|
38
42
|
c.desc 'Only output changes, no version numbers, headers, or dates'
|
|
39
43
|
c.switch %i[C changes], default_value: false, negatable: false
|
|
40
44
|
|
|
41
45
|
c.desc 'Output raw Markdown'
|
|
42
46
|
c.switch %i[m md markdown], default_value: false, negatable: false
|
|
43
47
|
|
|
48
|
+
c.desc 'Force rendered output'
|
|
49
|
+
c.switch %i[render], default_value: false, negatable: false
|
|
50
|
+
|
|
51
|
+
c.desc 'Open changelog in interactive viewer'
|
|
52
|
+
c.switch %i[i interactive], default_value: false, negatable: false
|
|
53
|
+
|
|
44
54
|
c.example 'doing changes', desc: 'View changes in the current version'
|
|
45
55
|
c.example 'doing changes --all', desc: 'See the entire changelog'
|
|
46
56
|
c.example 'doing changes --lookup 2.0.21', desc: 'See changes from version 2.0.21'
|
|
@@ -49,21 +59,25 @@ command %i[changes changelog] do |c|
|
|
|
49
59
|
c.example 'doing changes -l "> 2.1" -s "pattern"', desc: 'Lookup and search can be combined'
|
|
50
60
|
|
|
51
61
|
c.action do |_global_options, options, _args|
|
|
52
|
-
cl = Doing::Changes.new(lookup: options[:lookup], search: options[:search],
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
cl = Doing::Changes.new(lookup: options[:lookup], search: options[:search], changes: options[:changes], sort: options[:sort])
|
|
63
|
+
|
|
64
|
+
if options[:interactive]
|
|
65
|
+
cl.interactive
|
|
66
|
+
else
|
|
67
|
+
content = if options[:all] || options[:search] || options[:lookup]
|
|
68
|
+
cl.to_s
|
|
69
|
+
else
|
|
70
|
+
cl.latest
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
parsed = if (options[:markdown] || !$stdout.isatty) && !options[:render]
|
|
74
|
+
content
|
|
75
|
+
else
|
|
76
|
+
TTY::Markdown.parse(content, width: 80, theme: MARKDOWN_THEME, symbols: { override: { bullet: '•' } })
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
Doing::Pager.paginate = true
|
|
80
|
+
Doing::Pager.page parsed
|
|
81
|
+
end
|
|
68
82
|
end
|
|
69
83
|
end
|
data/bin/commands/commands.rb
CHANGED
|
@@ -15,8 +15,8 @@ command :commands do |c|
|
|
|
15
15
|
c.arg_name 'COMMAND [COMMAND...]'
|
|
16
16
|
c.command %i[add enable] do |add|
|
|
17
17
|
add.action do |_global, _options, args|
|
|
18
|
-
cfg =
|
|
19
|
-
custom_dir =
|
|
18
|
+
cfg = Doing.settings
|
|
19
|
+
custom_dir = cfg.dig('plugins', 'command_path')
|
|
20
20
|
|
|
21
21
|
available = cfg['disabled_commands']
|
|
22
22
|
raise UserCancelled, 'No commands available to enable' unless args.good? || available.good?
|
|
@@ -45,8 +45,8 @@ command :commands do |c|
|
|
|
45
45
|
|
|
46
46
|
cfg.deep_set(['disabled_commands'], available)
|
|
47
47
|
|
|
48
|
-
Doing::Util.write_to_file(
|
|
49
|
-
Doing.logger.warn('Config:', "#{
|
|
48
|
+
Doing::Util.write_to_file(Doing.config.config_file, YAML.dump(cfg), backup: true)
|
|
49
|
+
Doing.logger.warn('Config:', "#{Doing.config.config_file} updated")
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -55,8 +55,8 @@ command :commands do |c|
|
|
|
55
55
|
c.command %i[remove disable] do |remove|
|
|
56
56
|
remove.action do |_global, _options, args|
|
|
57
57
|
available = Dir.glob(File.join(File.dirname(__FILE__), '*.rb')).map { |cmd| File.basename(cmd, '.rb') }
|
|
58
|
-
cfg =
|
|
59
|
-
custom_dir =
|
|
58
|
+
cfg = Doing.settings
|
|
59
|
+
custom_dir = cfg.dig('plugins', 'command_path')
|
|
60
60
|
custom_commands = Dir.glob(File.join(File.expand_path(custom_dir), '*.rb'))
|
|
61
61
|
available.concat(custom_commands.map { |cmd| File.basename(cmd, '.rb') })
|
|
62
62
|
disabled = cfg['disabled_commands']
|
|
@@ -82,8 +82,8 @@ command :commands do |c|
|
|
|
82
82
|
|
|
83
83
|
cfg.deep_set(['disabled_commands'], disabled.concat(to_disable))
|
|
84
84
|
|
|
85
|
-
Doing::Util.write_to_file(
|
|
86
|
-
Doing.logger.warn('Config:', "#{
|
|
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")
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
end
|
data/bin/commands/completion.rb
CHANGED
|
@@ -1,27 +1,69 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
SHELLS = %w[zsh bash fish all].freeze
|
|
4
|
+
SHELL_RX = /^(?:[bzf](?:[ai]?sh)?|all)$/i.freeze
|
|
5
|
+
|
|
3
6
|
# @@completion
|
|
4
|
-
desc 'Generate shell completion scripts'
|
|
7
|
+
desc 'Generate shell completion scripts for doing'
|
|
5
8
|
long_desc 'Generates the necessary scripts to add command line completion to various shells,
|
|
6
9
|
so typing \'doing\' and hitting tab will offer completions of subcommands and their options.'
|
|
7
10
|
command :completion do |c|
|
|
8
|
-
c.example 'doing completion
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
c.example 'doing completion
|
|
12
|
-
desc: '
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
c.
|
|
18
|
-
c.
|
|
19
|
-
|
|
20
|
-
c.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
c.example 'doing completion install zsh',
|
|
12
|
+
desc: 'Install the default zsh completion script and link it to the zsh autolaod directory.'
|
|
13
|
+
c.example 'doing completion generate zsh', desc: 'Generate zsh (default) script to default file, offer to symlink'
|
|
14
|
+
c.example 'doing completion generate fish --file ~/doing.fish',
|
|
15
|
+
desc: 'Generate fish completions to alternative file'
|
|
16
|
+
|
|
17
|
+
c.desc 'Deprecated, specify shell as argument to subcommand'
|
|
18
|
+
c.flag %i[t type], must_match: SHELL_RX
|
|
19
|
+
|
|
20
|
+
c.desc 'Generate completion scripts, including custom plugins and command options'
|
|
21
|
+
c.long_desc "Argument specifies which shell to install for: #{SHELLS.join(', ')}"
|
|
22
|
+
c.arg_name "[#{SHELLS.join('|')}]"
|
|
23
|
+
c.command :generate do |gen|
|
|
24
|
+
gen.example 'doing completion generate fish', desc: 'Generate fish completion script and link to autoload directory'
|
|
25
|
+
gen.example 'doing completion generate zsh --file ~/.zsh-completions/doing.zsh', desc: 'Generate zsh completion script and save to alternative file'
|
|
26
|
+
|
|
27
|
+
gen.desc 'Alternative file to write output to'
|
|
28
|
+
gen.arg_name 'PATH'
|
|
29
|
+
gen.flag %i[f file]
|
|
30
|
+
|
|
31
|
+
gen.desc 'Output result to STDOUT only'
|
|
32
|
+
gen.switch [:stdout], negatable: false
|
|
33
|
+
|
|
34
|
+
gen.action do |_global_options, options, args|
|
|
35
|
+
args = [options[:type]] if options[:type] && args.count.zero?
|
|
36
|
+
|
|
37
|
+
raise MissingArgument, "Specify a shell (#{SHELLS.join('|')})" unless args.count.positive?
|
|
38
|
+
|
|
39
|
+
file = options[:stdout] ? 'stdout' : options[:file] || :default
|
|
40
|
+
|
|
41
|
+
raise InvalidArgument, '--file can not be used with multiple arguments' if options[:file] && args.count > 1
|
|
42
|
+
|
|
43
|
+
args.each do |shell|
|
|
44
|
+
type = Doing::Completion.normalize_type(shell)
|
|
45
|
+
raise InvalidArgument, "Unknown shell #{shell}" if type == :invalid
|
|
46
|
+
|
|
47
|
+
Doing::Completion.generate_completion(type: type, file: file)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
c.desc 'Install default completion scripts'
|
|
53
|
+
c.long_desc 'Argument specifies which shell to install for: zsh, bash, fish, or all'
|
|
54
|
+
c.arg_name '[zsh|bash|fish]'
|
|
55
|
+
c.command :install do |install|
|
|
56
|
+
install.example 'doing completion install zsh', desc: 'Install and link zsh completion script'
|
|
57
|
+
|
|
58
|
+
# install.flag %i[t type], must_match: /^(?:[bzf](?:[ai]?sh)?|all)$/i
|
|
59
|
+
|
|
60
|
+
install.action do |_global_options, options, args|
|
|
61
|
+
type = options[:type] || args[0]&.strip || 'zsh'
|
|
62
|
+
raise InvalidArgument, "Unknown shell #{type}" unless type =~ SHELL_RX
|
|
63
|
+
|
|
64
|
+
Doing::Completion.link_default(type)
|
|
65
|
+
end
|
|
26
66
|
end
|
|
67
|
+
|
|
68
|
+
c.default_command :generate
|
|
27
69
|
end
|
data/bin/commands/config.rb
CHANGED
|
@@ -30,8 +30,8 @@ command :config do |c|
|
|
|
30
30
|
Values defined in the top item in the list will override values in configutations below it.'
|
|
31
31
|
c.command :list do |list|
|
|
32
32
|
list.action do |global, options, args|
|
|
33
|
-
puts
|
|
34
|
-
puts
|
|
33
|
+
puts Doing.config.additional_configs.join("\n")
|
|
34
|
+
puts Doing.config.config_file
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -45,7 +45,7 @@ command :config do |c|
|
|
|
45
45
|
edit.arg_name 'EDITOR'
|
|
46
46
|
edit.flag %i[e editor], default_value: nil
|
|
47
47
|
|
|
48
|
-
if
|
|
48
|
+
if Sys::Platform.mac?
|
|
49
49
|
edit.desc 'Application to use'
|
|
50
50
|
edit.arg_name 'APP_NAME'
|
|
51
51
|
edit.flag %i[a app]
|
|
@@ -74,9 +74,9 @@ command :config do |c|
|
|
|
74
74
|
return
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
config_file =
|
|
77
|
+
config_file = Doing.config.choose_config
|
|
78
78
|
|
|
79
|
-
if
|
|
79
|
+
if Sys::Platform.mac?
|
|
80
80
|
if options[:default]
|
|
81
81
|
editor = Doing::Util.find_default_editor('config')
|
|
82
82
|
if editor
|
|
@@ -118,7 +118,7 @@ command :config do |c|
|
|
|
118
118
|
c.desc 'Update default config file, adding any missing keys'
|
|
119
119
|
c.command %i[update refresh] do |update|
|
|
120
120
|
update.action do |_global, options, args|
|
|
121
|
-
|
|
121
|
+
Doing.config.configure({rewrite: true, ignore_local: true})
|
|
122
122
|
Doing.logger.warn('Config:', 'config refreshed')
|
|
123
123
|
end
|
|
124
124
|
end
|
|
@@ -127,7 +127,7 @@ command :config do |c|
|
|
|
127
127
|
c.desc 'Undo the last change to a config file'
|
|
128
128
|
c.command :undo do |undo|
|
|
129
129
|
undo.action do |_global, options, args|
|
|
130
|
-
config_file =
|
|
130
|
+
config_file = Doing.config.choose_config
|
|
131
131
|
Doing::Util::Backup.restore_last_backup(config_file, count: 1)
|
|
132
132
|
end
|
|
133
133
|
end
|
|
@@ -139,7 +139,7 @@ command :config do |c|
|
|
|
139
139
|
dump.example 'doing config get', desc: 'Output the entire configuration'
|
|
140
140
|
dump.example 'doing config get timer_format --output raw', desc: 'Output the value of timer_format as a plain string'
|
|
141
141
|
dump.example 'doing config get doing_file', desc: 'Output the value of the doing_file setting, respecting local configurations'
|
|
142
|
-
dump.example 'doing config get -o json plug.plugpath', desc: 'Key path is fuzzy matched: output the value of plugins
|
|
142
|
+
dump.example 'doing config get -o json plug.plugpath', desc: 'Key path is fuzzy matched: output the value of plugins.plugin_path as JSON'
|
|
143
143
|
|
|
144
144
|
dump.desc 'Format for output (json|yaml|raw)'
|
|
145
145
|
dump.arg_name 'FORMAT'
|
|
@@ -148,8 +148,8 @@ command :config do |c|
|
|
|
148
148
|
dump.action do |_global, options, args|
|
|
149
149
|
|
|
150
150
|
keypath = args.join('.')
|
|
151
|
-
cfg =
|
|
152
|
-
real_path =
|
|
151
|
+
cfg = Doing.config.value_for_key(keypath)
|
|
152
|
+
real_path = Doing.config.resolve_key_path(keypath)
|
|
153
153
|
|
|
154
154
|
if cfg
|
|
155
155
|
val = cfg.map {|k, v| v }[0]
|
|
@@ -188,7 +188,7 @@ command :config do |c|
|
|
|
188
188
|
c.arg 'KEY VALUE'
|
|
189
189
|
c.command :set do |set|
|
|
190
190
|
set.example 'doing config set timer_format human', desc: 'Set the value of timer_format to "human"'
|
|
191
|
-
set.example 'doing config set plug.plugpath ~/my_plugins', desc: 'Key path is fuzzy matched: set the value of plugins
|
|
191
|
+
set.example 'doing config set plug.plugpath ~/my_plugins', desc: 'Key path is fuzzy matched: set the value of plugins.plugin_path'
|
|
192
192
|
|
|
193
193
|
set.desc 'Delete specified key'
|
|
194
194
|
set.switch %i[r remove], default_value: false, negatable: false
|
|
@@ -201,12 +201,12 @@ command :config do |c|
|
|
|
201
201
|
|
|
202
202
|
value = options[:remove] ? nil : args.pop
|
|
203
203
|
keypath = args.join('.')
|
|
204
|
-
real_path =
|
|
204
|
+
real_path = Doing.config.resolve_key_path(keypath, create: true)
|
|
205
205
|
old_value = @settings.dig(*real_path)
|
|
206
206
|
old_type = old_value&.class.to_s || nil
|
|
207
207
|
|
|
208
208
|
if old_value.is_a?(Hash) && !options[:remove]
|
|
209
|
-
Doing.logger.log_now(:warn, 'Config:', "Config key must point to a single value, #{real_path.join('
|
|
209
|
+
Doing.logger.log_now(:warn, 'Config:', "Config key must point to a single value, #{real_path.join('.').boldwhite} is a mapping")
|
|
210
210
|
didyou = 'Did you mean:'
|
|
211
211
|
old_value.keys.each do |k|
|
|
212
212
|
Doing.logger.log_now(:warn, "#{didyou}", "#{keypath}.#{k}?")
|
|
@@ -216,7 +216,7 @@ command :config do |c|
|
|
|
216
216
|
|
|
217
217
|
end
|
|
218
218
|
|
|
219
|
-
config_file =
|
|
219
|
+
config_file = Doing.config.choose_config(create: true)
|
|
220
220
|
|
|
221
221
|
cfg = Doing::Util.safe_load_file(config_file) || {}
|
|
222
222
|
|
|
@@ -224,11 +224,11 @@ command :config do |c|
|
|
|
224
224
|
|
|
225
225
|
if options[:remove]
|
|
226
226
|
cfg.deep_set(real_path, nil)
|
|
227
|
-
$stderr.puts "#{'Deleting key:'.yellow} #{real_path.join('
|
|
227
|
+
$stderr.puts "#{'Deleting key:'.yellow} #{real_path.join('.').boldwhite}"
|
|
228
228
|
else
|
|
229
229
|
current_value = cfg.dig(*real_path)
|
|
230
230
|
cfg.deep_set(real_path, value.set_type(old_type))
|
|
231
|
-
$stderr.puts "#{' Key path:'.yellow} #{real_path.join('
|
|
231
|
+
$stderr.puts "#{' Key path:'.yellow} #{real_path.join('.').boldwhite}"
|
|
232
232
|
$stderr.puts "#{'Inherited:'.yellow} #{(old_value ? old_value.to_s : 'empty').boldwhite}"
|
|
233
233
|
$stderr.puts "#{' Current:'.yellow} #{ (current_value ? current_value.to_s : 'empty').boldwhite }"
|
|
234
234
|
$stderr.puts "#{' New:'.yellow} #{value.set_type(old_type).to_s.boldwhite}"
|
data/bin/commands/done.rb
CHANGED
data/bin/commands/flag.rb
CHANGED
|
@@ -34,7 +34,7 @@ command %i[mark flag] do |c|
|
|
|
34
34
|
|
|
35
35
|
c.action do |_global_options, options, _args|
|
|
36
36
|
options[:fuzzy] = false
|
|
37
|
-
mark =
|
|
37
|
+
mark = Doing.setting('marker_tag', 'flagged')
|
|
38
38
|
|
|
39
39
|
raise InvalidArgument, '--search and --tag can not be used together' if options[:search] && options[:tag]
|
|
40
40
|
|
data/bin/commands/grep.rb
CHANGED
|
@@ -38,7 +38,7 @@ command %i[grep search] do |c|
|
|
|
38
38
|
c.switch [:totals], default_value: false, negatable: false
|
|
39
39
|
|
|
40
40
|
c.desc 'Sort tags by (name|time)'
|
|
41
|
-
default =
|
|
41
|
+
default = Doing.setting('tag_sort').normalize_tag_sort || :name
|
|
42
42
|
c.arg_name 'KEY'
|
|
43
43
|
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
|
44
44
|
|
|
@@ -49,7 +49,7 @@ command %i[grep search] do |c|
|
|
|
49
49
|
# c.switch [:fuzzy], default_value: false, negatable: false
|
|
50
50
|
|
|
51
51
|
c.desc 'Force exact string matching (case sensitive)'
|
|
52
|
-
c.switch %i[x exact], default_value:
|
|
52
|
+
c.switch %i[x exact], default_value: Doing.config.exact_match?, negatable: Doing.config.exact_match?
|
|
53
53
|
|
|
54
54
|
c.desc 'Show items that *don\'t* match search string'
|
|
55
55
|
c.switch [:not], default_value: false, negatable: false
|
|
@@ -57,11 +57,11 @@ command %i[grep search] do |c|
|
|
|
57
57
|
c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
|
|
58
58
|
c.arg_name 'TYPE'
|
|
59
59
|
c.flag [:case], must_match: REGEX_CASE,
|
|
60
|
-
default_value:
|
|
60
|
+
default_value: Doing.settings.dig('search', 'case').normalize_case,
|
|
61
61
|
type: CaseSymbol
|
|
62
62
|
|
|
63
63
|
c.desc "Highlight search matches in output. Only affects command line output"
|
|
64
|
-
c.switch %i[h hilite], default_value:
|
|
64
|
+
c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
|
|
65
65
|
|
|
66
66
|
c.desc "Edit matching entries with #{Doing::Util.default_editor}"
|
|
67
67
|
c.switch %i[e editor], negatable: false, default_value: false
|
|
@@ -88,7 +88,7 @@ command %i[grep search] do |c|
|
|
|
88
88
|
options[:fuzzy] = false
|
|
89
89
|
raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
|
|
90
90
|
|
|
91
|
-
template =
|
|
91
|
+
template = Doing.setting(['templates', options[:config_template]]).deep_merge(Doing.settings)
|
|
92
92
|
tags_color = template.key?('tags_color') ? template['tags_color'] : nil
|
|
93
93
|
|
|
94
94
|
section = @wwid.guess_section(options[:section]) if options[:section]
|
data/bin/commands/last.rb
CHANGED
|
@@ -30,7 +30,7 @@ command :last do |c|
|
|
|
30
30
|
c.flag [:template]
|
|
31
31
|
|
|
32
32
|
c.desc "Highlight search matches in output. Only affects command line output"
|
|
33
|
-
c.switch %i[h hilite], default_value:
|
|
33
|
+
c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
|
|
34
34
|
|
|
35
35
|
c.desc 'Show elapsed time if entry is not tagged @done'
|
|
36
36
|
c.switch [:duration]
|
data/bin/commands/meanwhile.rb
CHANGED
data/bin/commands/now.rb
CHANGED
|
@@ -54,7 +54,7 @@ command %i[now next] do |c|
|
|
|
54
54
|
section = if options[:section]
|
|
55
55
|
@wwid.guess_section(options[:section]) || options[:section].cap_first
|
|
56
56
|
else
|
|
57
|
-
|
|
57
|
+
Doing.setting('current_section')
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
ask_note = if options[:ask] && !options[:editor] && args.count.positive?
|
data/bin/commands/on.rb
CHANGED
|
@@ -23,7 +23,7 @@ command :on do |c|
|
|
|
23
23
|
c.switch [:totals], default_value: false, negatable: false
|
|
24
24
|
|
|
25
25
|
c.desc 'Sort tags by (name|time)'
|
|
26
|
-
default =
|
|
26
|
+
default = Doing.setting('tag_sort').normalize_tag_sort || :name
|
|
27
27
|
c.arg_name 'KEY'
|
|
28
28
|
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
|
29
29
|
|
data/bin/commands/open.rb
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# @@open
|
|
2
2
|
desc 'Open the "doing" file in an editor'
|
|
3
|
-
long_desc "`doing open` defaults to using the editors
|
|
4
|
-
in #{
|
|
3
|
+
long_desc "`doing open` defaults to using the editors.doing_file setting
|
|
4
|
+
in #{Doing.config.config_file} (#{Doing::Util.find_default_editor('doing_file')})."
|
|
5
5
|
command :open do |c|
|
|
6
6
|
c.example 'doing open', desc: 'Open the doing file in the default editor'
|
|
7
7
|
c.desc 'Open with editor command (e.g. vim, mate)'
|
|
8
8
|
c.arg_name 'COMMAND'
|
|
9
9
|
c.flag %i[e editor]
|
|
10
10
|
|
|
11
|
-
if
|
|
11
|
+
if Sys::Platform.mac?
|
|
12
12
|
c.desc 'Open with app name'
|
|
13
13
|
c.arg_name 'APP_NAME'
|
|
14
14
|
c.flag %i[a app]
|
|
@@ -29,7 +29,7 @@ command :open do |c|
|
|
|
29
29
|
|
|
30
30
|
editor = TTY::Which.which(options[:editor])
|
|
31
31
|
system %(#{editor} "#{File.expand_path(@wwid.doing_file)}")
|
|
32
|
-
elsif
|
|
32
|
+
elsif Sys::Platform.mac?
|
|
33
33
|
if options[:app]
|
|
34
34
|
system %(open -a "#{options[:app]}" "#{File.expand_path(@wwid.doing_file)}")
|
|
35
35
|
elsif options[:bundle_id]
|
data/bin/commands/recent.rb
CHANGED
|
@@ -30,7 +30,7 @@ command :recent do |c|
|
|
|
30
30
|
c.switch [:totals], default_value: false, negatable: false
|
|
31
31
|
|
|
32
32
|
c.desc 'Sort tags by (name|time)'
|
|
33
|
-
default =
|
|
33
|
+
default = Doing.setting('tag_sort').normalize_tag_sort || :name
|
|
34
34
|
c.arg_name 'KEY'
|
|
35
35
|
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
|
36
36
|
|
|
@@ -41,8 +41,8 @@ command :recent do |c|
|
|
|
41
41
|
section = @wwid.guess_section(options[:section]) || options[:section].cap_first
|
|
42
42
|
|
|
43
43
|
unless global_options[:version]
|
|
44
|
-
if
|
|
45
|
-
config_count =
|
|
44
|
+
if Doing.setting('templates.recent.count')
|
|
45
|
+
config_count = Doing.setting('templates.recent.count').to_i
|
|
46
46
|
else
|
|
47
47
|
config_count = 10
|
|
48
48
|
end
|
|
@@ -56,7 +56,7 @@ command :recent do |c|
|
|
|
56
56
|
options[:times] = true if options[:totals]
|
|
57
57
|
options[:sort_tags] = options[:tag_sort]
|
|
58
58
|
|
|
59
|
-
template =
|
|
59
|
+
template = Doing.setting('templates.recent').deep_merge(Doing.setting('templates.default'))
|
|
60
60
|
tags_color = template.key?('tags_color') ? template['tags_color'] : nil
|
|
61
61
|
|
|
62
62
|
opts = {
|
data/bin/commands/show.rb
CHANGED
|
@@ -27,7 +27,7 @@ command :show do |c|
|
|
|
27
27
|
c.flag %i[a age], default_value: :newest, type: AgeSymbol
|
|
28
28
|
|
|
29
29
|
c.desc "Highlight search matches in output. Only affects command line output"
|
|
30
|
-
c.switch %i[h hilite], default_value:
|
|
30
|
+
c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
|
|
31
31
|
|
|
32
32
|
c.desc 'Sort order (asc/desc)'
|
|
33
33
|
c.arg_name 'ORDER'
|
|
@@ -43,7 +43,7 @@ command :show do |c|
|
|
|
43
43
|
c.switch [:totals], default_value: false, negatable: false
|
|
44
44
|
|
|
45
45
|
c.desc 'Sort tags by (name|time)'
|
|
46
|
-
default =
|
|
46
|
+
default = Doing.setting('tag_sort').normalize_tag_sort || :name
|
|
47
47
|
c.arg_name 'KEY'
|
|
48
48
|
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
|
49
49
|
|
|
@@ -118,7 +118,7 @@ command :show do |c|
|
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
120
|
else
|
|
121
|
-
section = options[:menu] ? @wwid.choose_section(include_all: true) :
|
|
121
|
+
section = options[:menu] ? @wwid.choose_section(include_all: true) : Doing.setting('current_section')
|
|
122
122
|
section ||= 'All'
|
|
123
123
|
end
|
|
124
124
|
|
|
@@ -126,11 +126,11 @@ command :show do |c|
|
|
|
126
126
|
|
|
127
127
|
options[:times] = true if options[:totals]
|
|
128
128
|
|
|
129
|
-
template =
|
|
130
|
-
'wrap_width' =>
|
|
131
|
-
'date_format' =>
|
|
132
|
-
'order' =>
|
|
133
|
-
'tags_color' =>
|
|
129
|
+
template = Doing.setting(['templates', options[:config_template]]).deep_merge({
|
|
130
|
+
'wrap_width' => Doing.setting('wrap_width') || 0,
|
|
131
|
+
'date_format' => Doing.setting('default_date_format'),
|
|
132
|
+
'order' => Doing.setting('order')&.normalize_order || :asc,
|
|
133
|
+
'tags_color' => Doing.setting('tags_color')
|
|
134
134
|
})
|
|
135
135
|
|
|
136
136
|
if options[:search]
|
data/bin/commands/since.rb
CHANGED
|
@@ -21,7 +21,7 @@ command :since do |c|
|
|
|
21
21
|
c.switch [:totals], default_value: false, negatable: false
|
|
22
22
|
|
|
23
23
|
c.desc 'Sort tags by (name|time)'
|
|
24
|
-
default =
|
|
24
|
+
default = Doing.setting('tag_sort').normalize_tag_sort || :name
|
|
25
25
|
c.arg_name 'KEY'
|
|
26
26
|
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
|
27
27
|
|
data/bin/commands/today.rb
CHANGED
|
@@ -22,7 +22,7 @@ command :today do |c|
|
|
|
22
22
|
c.switch [:totals], default_value: false, negatable: false
|
|
23
23
|
|
|
24
24
|
c.desc 'Sort tags by (name|time)'
|
|
25
|
-
default =
|
|
25
|
+
default = Doing.setting('tag_sort').normalize_tag_sort || :name
|
|
26
26
|
c.arg_name 'KEY'
|
|
27
27
|
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
|
28
28
|
|