doing 2.0.24 → 2.0.25
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/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/bin/doing +142 -70
- data/doing.rdoc +45 -21
- data/example_plugin.rb +2 -2
- data/lib/completion/_doing.zsh +41 -41
- data/lib/completion/doing.bash +2 -2
- data/lib/completion/doing.fish +0 -279
- data/lib/doing/completion/bash_completion.rb +1 -2
- data/lib/doing/completion/fish_completion.rb +1 -1
- data/lib/doing/completion/zsh_completion.rb +1 -1
- data/lib/doing/configuration.rb +85 -15
- data/lib/doing/string.rb +30 -18
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +2 -5
- data/rdoc_to_mmd.rb +14 -8
- data/scripts/generate_bash_completions.rb +1 -1
- data/scripts/generate_fish_completions.rb +1 -1
- data/scripts/generate_zsh_completions.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fc7ae9d7369be36fcfb7bdd888ed7a6342d998e9ca77c5647ae2386fbaff3ca
|
4
|
+
data.tar.gz: b2b71651788d3e99b71a964a6ac93b2b485adf9467e2cec2bc66e51c49314a8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b11ec84f5b92b9938ac95f5e9dd2777ba9b218ed918ffa9de2082f3129a683d3fd6f112db775e479dc0967e9af2f5a619cbfafcd6416c35fcbeaf3df05c0c33
|
7
|
+
data.tar.gz: 3f87f827b16fdbe04440d8b58253a3cd209de909fa0be9369ab9638c85da8753d41237d0028c3fe37deef64ad742890c5fd91877373ef3a4b562b5331eddbb42
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 2.0.25
|
2
|
+
|
3
|
+
#### NEW
|
4
|
+
|
5
|
+
- `doing config set` to set single config values from command line
|
6
|
+
- BREAKING CHANGE: Moves ~/.doingrc to ~/.config/doing/config.yml
|
7
|
+
- BREAKING CHANGE: convert config flags to subcommands, e.g. `doing config --udpate` => `doing config update`, and `doing config --dump` => `doing config dump`
|
8
|
+
|
1
9
|
### 2.0.24
|
2
10
|
|
3
11
|
- include fzf source directly, in case git isn't installed
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ _If you're one of the rare people like me who find this useful, feel free to [bu
|
|
6
6
|
|
7
7
|
<!--README-->
|
8
8
|
|
9
|
-
The current version of `doing` is <!--VER-->2.0.
|
9
|
+
The current version of `doing` is <!--VER-->2.0.24<!--END VER-->.
|
10
10
|
|
11
11
|
Find all of the documentation in the [doing wiki](https://github.com/ttscoff/doing/wiki).
|
12
12
|
|
@@ -41,6 +41,12 @@ See the [doing project on BrettTerpstra.com](https://brettterpstra.com/projects/
|
|
41
41
|
|
42
42
|
Evan Lovely has [created an Alfred workflow as well](http://www.evanlovely.com/blog/technology/alfred-for-terpstras-doing/).
|
43
43
|
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
If you [create a plugin](https://github.com/ttscoff/doing/wiki/Creating-Plugins), custom command, or hook you can share, please [let me know](https://brettterpstra.com/contact/). If I get a few plugin contributions, I'll set up a second repository for them.
|
47
|
+
|
48
|
+
Feel free to fork [the repository](https://github.com/ttscoff/doing/) on GitHub and make pull requests with changes. Please target the `develop` branch with pull requests.
|
49
|
+
|
44
50
|
<!--END README-->
|
45
51
|
|
46
52
|
---
|
data/bin/doing
CHANGED
@@ -1188,7 +1188,7 @@ command :tag do |c|
|
|
1188
1188
|
c.desc 'Tag last entry (or entries) not marked @done'
|
1189
1189
|
c.switch %i[u unfinished], negatable: false, default_value: false
|
1190
1190
|
|
1191
|
-
c.desc 'Autotag entries based on autotag configuration in ~/.
|
1191
|
+
c.desc 'Autotag entries based on autotag configuration in ~/.config/doing/config.yml'
|
1192
1192
|
c.switch %i[a autotag], negatable: false, default_value: false
|
1193
1193
|
|
1194
1194
|
c.desc 'Tag the last X entries containing TAG.
|
@@ -2591,55 +2591,138 @@ command :open do |c|
|
|
2591
2591
|
end
|
2592
2592
|
|
2593
2593
|
desc 'Edit the configuration file or output a value from it'
|
2594
|
-
long_desc %(Run without arguments, `doing config` opens your
|
2594
|
+
long_desc %(Run without arguments, `doing config` opens your `config.yml` in an editor.
|
2595
2595
|
If local configurations are found in the path between the current directory
|
2596
|
-
and
|
2596
|
+
and the root (/), a menu will allow you to select which to open in the editor.
|
2597
2597
|
|
2598
2598
|
It will use the editor defined in `config_editor_app`, or one specified with `--editor`.
|
2599
2599
|
|
2600
|
-
Use `doing config
|
2600
|
+
Use `doing config get` to output the configuration to the terminal, and
|
2601
2601
|
provide a dot-separated key path to get a specific value. Shows the current value
|
2602
2602
|
including keys/overrides set by local configs.)
|
2603
|
-
arg_name 'KEY_PATH'
|
2604
2603
|
command :config do |c|
|
2605
2604
|
c.example 'doing config', desc: "Open an active configuration in #{Doing::Util.find_default_editor('config')}"
|
2606
|
-
c.example 'doing config
|
2607
|
-
c.example 'doing config
|
2605
|
+
c.example 'doing config get doing_file', desc: 'Output the value of a config key as YAML'
|
2606
|
+
c.example 'doing config get plugins.plugin_path -o json', desc: 'Output the value of a key path as JSON'
|
2607
|
+
c.example 'doing config set plugins.say.say_voice Alex', desc: 'Set the value of a key path and update config file'
|
2608
|
+
c.example 'doing config set plug.say.voice Zarvox', desc: 'Key paths for get and set are fuzzy matched'
|
2608
2609
|
|
2609
|
-
c.
|
2610
|
-
c.arg_name 'EDITOR'
|
2611
|
-
c.flag %i[e editor], default_value: nil
|
2610
|
+
c.default_command :edit
|
2612
2611
|
|
2613
|
-
c.desc '
|
2614
|
-
c.switch %i[d dump]
|
2612
|
+
c.desc 'DEPRECATED'
|
2613
|
+
c.switch %i[d dump]
|
2615
2614
|
|
2616
|
-
c.desc '
|
2617
|
-
c.
|
2618
|
-
c.flag %i[o output], default_value: 'yaml', must_match: /^(?:y(?:aml)?|j(?:son)?|r(?:aw)?)$/
|
2615
|
+
c.desc 'DEPRECATED'
|
2616
|
+
c.switch %i[u update]
|
2619
2617
|
|
2620
|
-
c.desc '
|
2621
|
-
c.
|
2618
|
+
c.desc 'Open config file in editor'
|
2619
|
+
c.command :edit do |edit|
|
2620
|
+
edit.example 'doing config edit', desc: 'Open a config file in the default editor'
|
2621
|
+
edit.example 'doing config edit --editor vim', desc: 'Open config in specific editor'
|
2622
2622
|
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
c.flag [:a]
|
2623
|
+
edit.desc 'Editor to use'
|
2624
|
+
edit.arg_name 'EDITOR'
|
2625
|
+
edit.flag %i[e editor], default_value: nil
|
2627
2626
|
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2627
|
+
if `uname` =~ /Darwin/
|
2628
|
+
edit.desc 'Application to use'
|
2629
|
+
edit.arg_name 'APP_NAME'
|
2630
|
+
edit.flag [:a]
|
2631
|
+
|
2632
|
+
edit.desc 'Application bundle id to use'
|
2633
|
+
edit.arg_name 'BUNDLE_ID'
|
2634
|
+
edit.flag [:b]
|
2635
|
+
|
2636
|
+
edit.desc "Use the config_editor_app defined in ~/.config/doing/config.yml (#{settings.key?('config_editor_app') ? settings['config_editor_app'] : 'config_editor_app not set'})"
|
2637
|
+
edit.switch [:x]
|
2638
|
+
end
|
2639
|
+
|
2640
|
+
edit.action do |global, options, args|
|
2641
|
+
if options[:update] || options[:dump]
|
2642
|
+
cmd = commands[:config]
|
2643
|
+
if options[:update]
|
2644
|
+
cmd = cmd.commands[:update]
|
2645
|
+
elsif options[:dump]
|
2646
|
+
cmd = cmd.commands[:get]
|
2647
|
+
end
|
2648
|
+
action = cmd.send(:get_action, nil)
|
2649
|
+
action.call(global, options, args)
|
2650
|
+
Doing.logger.warn('Deprecated:', '--dump and --update are deprecated,
|
2651
|
+
use `doing config get` and `doing config update`')
|
2652
|
+
Doing.logger.output_results
|
2653
|
+
return
|
2654
|
+
end
|
2655
|
+
|
2656
|
+
config_file = config.choose_config
|
2657
|
+
|
2658
|
+
if `uname` =~ /Darwin/
|
2659
|
+
if options[:x]
|
2660
|
+
editor = Doing::Util.find_default_editor('config')
|
2661
|
+
if editor
|
2662
|
+
if Doing::Util.exec_available(editor)
|
2663
|
+
system %(#{editor} "#{config_file}")
|
2664
|
+
else
|
2665
|
+
`open -a "#{editor}" "#{config_file}"`
|
2666
|
+
end
|
2667
|
+
else
|
2668
|
+
raise InvalidArgument, 'No viable editor found in config or environment.'
|
2669
|
+
end
|
2670
|
+
elsif options[:a] || options[:b]
|
2671
|
+
if options[:a]
|
2672
|
+
`open -a "#{options[:a]}" "#{config_file}"`
|
2673
|
+
elsif options[:b]
|
2674
|
+
`open -b #{options[:b]} "#{config_file}"`
|
2675
|
+
end
|
2676
|
+
else
|
2677
|
+
editor = options[:e] || Doing::Util.find_default_editor('config')
|
2678
|
+
|
2679
|
+
raise MissingEditor, 'No viable editor defined in config or environment' unless editor
|
2680
|
+
|
2681
|
+
if Doing::Util.exec_available(editor)
|
2682
|
+
system %(#{editor} "#{config_file}")
|
2683
|
+
else
|
2684
|
+
`open -a "#{editor}" "#{config_file}"`
|
2685
|
+
end
|
2686
|
+
end
|
2687
|
+
else
|
2688
|
+
editor = options[:e] || Doing::Util.default_editor
|
2689
|
+
raise MissingEditor, 'No EDITOR variable defined in environment' unless editor && Doing::Util.exec_available(editor)
|
2631
2690
|
|
2632
|
-
|
2633
|
-
|
2691
|
+
system %(#{editor} "#{config_file}")
|
2692
|
+
end
|
2693
|
+
end
|
2634
2694
|
end
|
2635
2695
|
|
2636
|
-
c.
|
2637
|
-
|
2696
|
+
c.desc 'Update default config file, adding any missing keys'
|
2697
|
+
c.command %i[update refresh] do |update|
|
2698
|
+
update.action do |_global, options, args|
|
2638
2699
|
config.configure({rewrite: true, ignore_local: true})
|
2639
|
-
|
2700
|
+
Doing.logger.warn('Config:', 'config refreshed')
|
2640
2701
|
end
|
2702
|
+
end
|
2703
|
+
|
2704
|
+
c.desc 'Undo the last change to a config file'
|
2705
|
+
c.command :undo do |undo|
|
2706
|
+
undo.action do |_global, options, args|
|
2707
|
+
config_file = config.choose_config
|
2708
|
+
wwid.restore_backup(config_file)
|
2709
|
+
end
|
2710
|
+
end
|
2711
|
+
|
2712
|
+
c.desc 'Output a key\'s value'
|
2713
|
+
c.arg 'KEY_PATH'
|
2714
|
+
c.command %i[get dump] do |dump|
|
2715
|
+
dump.example 'doing config get', desc: 'Output the entire configuration'
|
2716
|
+
dump.example 'doing config get timer_format --output raw', desc: 'Output the value of timer_format as a plain string'
|
2717
|
+
dump.example 'doing config get doing_file', desc: 'Output the value of the doing_file setting, respecting local configurations'
|
2718
|
+
dump.example 'doing config get -o json plug.plugpath', desc: 'Key path is fuzzy matched: output the value of plugins->plugin_path as JSON'
|
2719
|
+
|
2720
|
+
dump.desc 'Format for output (json|yaml|raw)'
|
2721
|
+
dump.arg_name 'FORMAT'
|
2722
|
+
dump.flag %i[o output], default_value: 'yaml', must_match: /^(?:y(?:aml)?|j(?:son)?|r(?:aw)?)$/
|
2723
|
+
|
2724
|
+
dump.action do |_global, options, args|
|
2641
2725
|
|
2642
|
-
if options[:dump]
|
2643
2726
|
keypath = args.join('.')
|
2644
2727
|
cfg = config.value_for_key(keypath)
|
2645
2728
|
|
@@ -2658,53 +2741,42 @@ command :config do |c|
|
|
2658
2741
|
Doing.logger.output_results
|
2659
2742
|
return
|
2660
2743
|
end
|
2744
|
+
end
|
2661
2745
|
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2746
|
+
c.desc 'Set a key\'s value in the config file'
|
2747
|
+
c.arg 'KEY VALUE'
|
2748
|
+
c.command :set do |set|
|
2749
|
+
set.example 'doing config set timer_format human', desc: 'Set the value of timer_format to "human"'
|
2750
|
+
set.example 'doing config set plug.plugpath ~/my_plugins', desc: 'Key path is fuzzy matched: set the value of plugins->plugin_path'
|
2666
2751
|
|
2667
|
-
|
2752
|
+
set.action do |_global, options, args|
|
2753
|
+
if args.count < 2
|
2754
|
+
raise InvalidArgument, 'config set requires at least two arguments, key path and value'
|
2668
2755
|
|
2669
|
-
|
2670
|
-
else
|
2671
|
-
config_file = config.config_file
|
2672
|
-
end
|
2756
|
+
end
|
2673
2757
|
|
2674
|
-
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
system %(#{editor} "#{config_file}")
|
2680
|
-
else
|
2681
|
-
`open -a "#{editor}" "#{config_file}"`
|
2682
|
-
end
|
2683
|
-
else
|
2684
|
-
raise InvalidArgument, 'No viable editor found in config or environment.'
|
2685
|
-
end
|
2686
|
-
elsif options[:a] || options[:b]
|
2687
|
-
if options[:a]
|
2688
|
-
`open -a "#{options[:a]}" "#{config_file}"`
|
2689
|
-
elsif options[:b]
|
2690
|
-
`open -b #{options[:b]} "#{config_file}"`
|
2691
|
-
end
|
2692
|
-
else
|
2693
|
-
editor = options[:e] || Doing::Util.find_default_editor('config')
|
2758
|
+
value = args.pop
|
2759
|
+
keypath = args.join('.')
|
2760
|
+
old_value = config.value_for_key(keypath).map { |k, v| v.to_s }
|
2761
|
+
real_path = config.resolve_key_path(keypath)
|
2762
|
+
raise InvalidArgument, 'Invalid key path' if real_path.empty?
|
2694
2763
|
|
2695
|
-
|
2764
|
+
key = real_path.last
|
2765
|
+
real_path[0...-1].inject(config.settings, :fetch)[key] = value
|
2696
2766
|
|
2697
|
-
|
2698
|
-
|
2699
|
-
|
2700
|
-
|
2701
|
-
|
2702
|
-
|
2703
|
-
|
2704
|
-
|
2705
|
-
raise
|
2767
|
+
config_file = config.choose_config
|
2768
|
+
|
2769
|
+
prev_level = Doing.logger.level
|
2770
|
+
Doing.logger.adjust_verbosity({ level: :info })
|
2771
|
+
Doing.logger.log_now(:info, 'Config:', "Updating #{config_file}")
|
2772
|
+
Doing.logger.log_now(:info, 'Config:', "#{real_path.join('->')} => #{value}")
|
2773
|
+
res = wwid.yn('Update selected config', default_response: true)
|
2774
|
+
|
2775
|
+
raise UserCancelled, 'Cancelled' unless res
|
2706
2776
|
|
2707
|
-
|
2777
|
+
Doing.logger.adjust_verbosity({ level: prev_level })
|
2778
|
+
Doing::Util.write_to_file(config_file, YAML.dump(config.settings), backup: true)
|
2779
|
+
Doing.logger.warn('Config:', "#{config_file} updated")
|
2708
2780
|
end
|
2709
2781
|
end
|
2710
2782
|
end
|
data/doing.rdoc
CHANGED
@@ -5,14 +5,14 @@ record of what you've been doing, complete with tag-based time tracking. The
|
|
5
5
|
command line tool allows you to add entries, annotate with tags and notes, and
|
6
6
|
view your entries with myriad options, with a focus on a "natural" language syntax.
|
7
7
|
|
8
|
-
v2.0.
|
8
|
+
v2.0.25
|
9
9
|
|
10
10
|
=== Global Options
|
11
11
|
=== --config_file arg
|
12
12
|
|
13
13
|
Use a specific configuration file. Deprecated, set $DOING_CONFIG instead.
|
14
14
|
|
15
|
-
[Default Value] /Users/ttscoff/.
|
15
|
+
[Default Value] /Users/ttscoff/.config/doing/config.yml
|
16
16
|
|
17
17
|
|
18
18
|
=== -f|--doing_file arg
|
@@ -385,63 +385,87 @@ Shell to generate for (bash, zsh, fish)
|
|
385
385
|
[Must Match] (?i-mx:^[bzf](?:[ai]?sh)?$)
|
386
386
|
|
387
387
|
|
388
|
-
==== Command: <tt>config
|
388
|
+
==== Command: <tt>config </tt>
|
389
389
|
Edit the configuration file or output a value from it
|
390
390
|
|
391
|
-
Run without arguments, `doing config` opens your
|
391
|
+
Run without arguments, `doing config` opens your `config.yml` in an editor.
|
392
392
|
If local configurations are found in the path between the current directory
|
393
|
-
and
|
393
|
+
and the root (/), a menu will allow you to select which to open in the editor.
|
394
394
|
|
395
395
|
It will use the editor defined in `config_editor_app`, or one specified with `--editor`.
|
396
396
|
|
397
|
-
Use `doing config
|
397
|
+
Use `doing config get` to output the configuration to the terminal, and
|
398
398
|
provide a dot-separated key path to get a specific value. Shows the current value
|
399
399
|
including keys/overrides set by local configs.
|
400
400
|
===== Options
|
401
|
-
===== -
|
401
|
+
===== -d|--[no-]dump
|
402
|
+
DEPRECATED
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
===== -u|--[no-]update
|
407
|
+
DEPRECATED
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
===== Commands
|
412
|
+
====== Command: <tt>edit </tt>
|
413
|
+
Open config file in editor
|
414
|
+
|
415
|
+
|
416
|
+
======= Options
|
417
|
+
======= -a APP_NAME
|
402
418
|
|
403
419
|
Application to use
|
404
420
|
|
405
421
|
[Default Value] None
|
406
422
|
|
407
423
|
|
408
|
-
|
424
|
+
======= -b BUNDLE_ID
|
409
425
|
|
410
426
|
Application bundle id to use
|
411
427
|
|
412
428
|
[Default Value] None
|
413
429
|
|
414
430
|
|
415
|
-
|
431
|
+
======= -e|--editor EDITOR
|
416
432
|
|
417
433
|
Editor to use
|
418
434
|
|
419
435
|
[Default Value] None
|
420
436
|
|
421
437
|
|
422
|
-
|
438
|
+
======= -x
|
439
|
+
Use the config_editor_app defined in ~/.config/doing/config.yml (config_editor_app not set)
|
423
440
|
|
424
|
-
Format for --dump (json|yaml|raw)
|
425
441
|
|
426
|
-
|
427
|
-
|
442
|
+
|
443
|
+
====== Command: <tt>get|dump </tt>
|
444
|
+
Output a key's value
|
428
445
|
|
429
446
|
|
430
|
-
|
431
|
-
|
447
|
+
======= Options
|
448
|
+
======= -o|--output FORMAT
|
432
449
|
|
450
|
+
Format for output (json|yaml|raw)
|
451
|
+
|
452
|
+
[Default Value] yaml
|
453
|
+
[Must Match] (?-mix:^(?:y(?:aml)?|j(?:son)?|r(?:aw)?)$)
|
433
454
|
|
434
455
|
|
435
|
-
|
436
|
-
|
456
|
+
====== Command: <tt>set </tt>
|
457
|
+
Set a key's value in the config file
|
437
458
|
|
438
459
|
|
460
|
+
====== Command: <tt>undo </tt>
|
461
|
+
Undo the last change to a config file
|
439
462
|
|
440
|
-
===== -x
|
441
|
-
Use the config_editor_app defined in ~/.doingrc (config_editor_app not set)
|
442
463
|
|
464
|
+
====== Command: <tt>update|refresh </tt>
|
465
|
+
Update default config file, adding any missing keys
|
443
466
|
|
444
467
|
|
468
|
+
[Default Command] edit
|
445
469
|
==== Command: <tt>done|did ENTRY</tt>
|
446
470
|
Add a completed item with @done(date). No argument finishes last entry.
|
447
471
|
|
@@ -1159,7 +1183,7 @@ Show time totals at the end of output
|
|
1159
1183
|
==== Command: <tt>open </tt>
|
1160
1184
|
Open the "doing" file in an editor
|
1161
1185
|
|
1162
|
-
`doing open` defaults to using the editor_app setting in /Users/ttscoff/.
|
1186
|
+
`doing open` defaults to using the editor_app setting in /Users/ttscoff/.config/doing/config.yml (not set).
|
1163
1187
|
===== Options
|
1164
1188
|
===== -a|--app APP_NAME
|
1165
1189
|
|
@@ -1734,7 +1758,7 @@ Tag the last X entries containing TAG.
|
|
1734
1758
|
|
1735
1759
|
|
1736
1760
|
===== -a|--autotag
|
1737
|
-
Autotag entries based on autotag configuration in ~/.
|
1761
|
+
Autotag entries based on autotag configuration in ~/.config/doing/config.yml
|
1738
1762
|
|
1739
1763
|
|
1740
1764
|
|
data/example_plugin.rb
CHANGED
@@ -14,13 +14,13 @@
|
|
14
14
|
# Change what the plugin says by generating a template with
|
15
15
|
# `doing template --type say`, saving it to a file, and
|
16
16
|
# putting the path to that file in `export_templates->say` in
|
17
|
-
# .
|
17
|
+
# config.yml.
|
18
18
|
#
|
19
19
|
# export_templates:
|
20
20
|
# say: /path/to/template.txt
|
21
21
|
#
|
22
22
|
# Use a different voice by adding a `say_voice` key to your
|
23
|
-
# .
|
23
|
+
# config.yml. Use `say -v ?` to see available voices.
|
24
24
|
#
|
25
25
|
# say_voice: Zarvox
|
26
26
|
|