doing 1.0.42 → 1.0.43

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f715c083c72c609fb2e2fc8c730cca68b8391dccbc4ca2168333dd9b30df0887
4
- data.tar.gz: 3d7df2ec9624ae8d2b6822ccceed402c42f82f2a5b2e010c639880c9cd95580f
3
+ metadata.gz: fa5febc2d54f2d65e4e09b1b72e65cd19c3ca19c2c5b7b155fae667071f77aeb
4
+ data.tar.gz: 1a8401a27918d5e1ec4b5b66ae6986e2130a3dde568f894c79e93b8b610ed8cb
5
5
  SHA512:
6
- metadata.gz: 4287daf5a4821ff6e295c36275d2101ecebefdc0adc962faefe82c460bd52f2e9a1a69e767e3ad59f7d68074a86807496e3e1669dd7f6f68688da903fb370309
7
- data.tar.gz: 4a62305048b02bac186c63f951a6e3a7985663dc826070801c3a333b8e9388147435639910ac0f1fe24b0ad5a90e15b61510c0799ce94cf84060ca8fad097f0b
6
+ metadata.gz: 558ee0d409f410ec30a15f5cf99194f1a9a6c98bc6d7711ccff5d8d88492166fd9d2ff12b3b3cf304fd3c393e975bb09cda92efadb6439db8d20fe12a7a9b882
7
+ data.tar.gz: 638222cb9655553bbd230262127ccb03b551bb03989ab58e2cfecb9908735a654e775203c379593e3b79cebef132fcb2f8bad1d8251e73836e9758e8e7e6988d
data/bin/doing CHANGED
@@ -488,6 +488,21 @@ command :finish do |c|
488
488
  end
489
489
  end
490
490
 
491
+ desc 'Repeat last entry as new entry'
492
+ arg_name 'section'
493
+ command [:again,:resume] do |c|
494
+ c.desc 'Section'
495
+ c.flag [:s, :section], :default_value => "All"
496
+
497
+ c.desc 'Note'
498
+ c.arg_name 'note_text'
499
+ c.flag [:n,:note]
500
+
501
+ c.action do |global_options, options, args|
502
+ wwid.restart_last({ section: options[:s], note: options[:n] })
503
+ end
504
+ end
505
+
491
506
  desc 'Tag last entry'
492
507
  arg_name 'tag1 [tag2...]'
493
508
  command :tag do |c|
@@ -555,7 +570,7 @@ command :tag do |c|
555
570
  end
556
571
 
557
572
  desc 'Mark last entry as highlighted'
558
- command :mark do |c|
573
+ command [:mark,:flag] do |c|
559
574
  c.desc 'Section'
560
575
  c.default_value wwid.current_section
561
576
  c.flag [:s,:section], :default_value => wwid.current_section
@@ -1212,7 +1227,15 @@ post do |global,command,options,args|
1212
1227
  if global[:stdout]
1213
1228
  $stdout.print wwid.results.join("\n")
1214
1229
  else
1215
- $stderr.puts wwid.results.join("\n")
1230
+ warn wwid.results.join("\n")
1231
+ end
1232
+
1233
+ if wwid.config['run_after']
1234
+ script = File.expand_path(wwid.config['run_after'])
1235
+ if File.exist?(script)
1236
+ warn "Running #{script}"
1237
+ `#{script}`
1238
+ end
1216
1239
  end
1217
1240
  end
1218
1241
 
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '1.0.42'
2
+ VERSION = '1.0.43'
3
3
  end
data/lib/doing/wwid.rb CHANGED
@@ -654,6 +654,62 @@ class WWID
654
654
  end
655
655
  end
656
656
 
657
+ ##
658
+ ## @brief Restart the last entry
659
+ ##
660
+ ## @param opt (Hash) Additional Options
661
+ ##
662
+ def restart_last(opt = {})
663
+ opt[:section] ||= 'all'
664
+ opt[:note] ||= []
665
+
666
+ last = last_entry(opt)
667
+ if last.nil?
668
+ @results.push(%Q{No previous entry found})
669
+ return
670
+ end
671
+ # Remove @done tag
672
+ title = last['title'].sub!(/\s*@done(\(.*?\))?/, '').chomp
673
+ add_item(title, last['section'], {:note => opt[:note], :back => opt[:date], :timed => true})
674
+ write(@doing_file)
675
+ end
676
+
677
+ ##
678
+ ## @brief Get the last entry
679
+ ##
680
+ ## @param opt (Hash) Additional Options
681
+ ##
682
+ def last_entry(opt={})
683
+ opt[:section] ||= @current_section
684
+
685
+ sec_arr = []
686
+
687
+ if opt[:section].nil?
688
+ sec_arr = [@current_section]
689
+ elsif opt[:section].class == String
690
+ if opt[:section] =~ /^all$/i
691
+ combined = {'items' => []}
692
+ @content.each {|k,v|
693
+ combined['items'] += v['items']
694
+ }
695
+ items = combined['items'].dup.sort_by{|item| item['date'] }.reverse
696
+ sec_arr.push(items[0]['section'])
697
+
698
+ sec_arr = sections
699
+ else
700
+ sec_arr = [guess_section(opt[:section])]
701
+ end
702
+ end
703
+
704
+
705
+ all_items = []
706
+ sec_arr.each do |section|
707
+ all_items.concat(@content[section]['items'].dup) if @content.has_key?(section)
708
+ end
709
+
710
+ all_items.sort_by { |item| item['date'] }.last
711
+ end
712
+
657
713
  ##
658
714
  ## @brief Tag the last entry or X entries
659
715
  ##
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.42
4
+ version: 1.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-25 00:00:00.000000000 Z
11
+ date: 2021-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake