doing 1.0.23 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d74d1d69c6dbae627fc25dc8c14a8e8bff95072fdc2f1b1761ab6186c7c0a26
4
- data.tar.gz: e17b0df1b7c2122c0d8ae33290ccf7e2763cf3e143acf0b60af061b8302c83d2
3
+ metadata.gz: b8701939f6f7f9ab73bd84b4f5eb12fb11000d4267b8e50bb95a586f3f3c031f
4
+ data.tar.gz: befe08c2e78ec8df076041cea7e2b7c114950003ffab85697e2fc934acca5c85
5
5
  SHA512:
6
- metadata.gz: 802dbf09b3b658640c52ca8e3b74f665fb163199bd0a3648f3f7831121e275a062df3ea47c31921b5b4f5390cbd29c3beeb7fa852624d0c00823a61081222cb9
7
- data.tar.gz: dea212e53281258c783b0155c3304ada1d26a08db58d27b521d0080c19dec93c40c86f35c086383642d081caf85ac2ecf931a3ad2df927a0c6047cdea6d05b2d
6
+ metadata.gz: bddd6093eeacb8f29539b67e02d8fd3b47f68c4350d8c8bb5d13c8b33fe02e6e62cbaa12c4a406880716a4bb5560ef4a5d52125e7c83e3168896bfa38d85c771
7
+ data.tar.gz: '094ba3ce7917a2e1d596f727a7cbd97b1e4eba0d3d1916810ddcccae1eda42082e0b8f8f818afa34c1dbedbd3ecaa3cbfd0d78beabb6f38f44580de84996f5da'
data/README.md CHANGED
@@ -600,6 +600,14 @@ Feel free to [poke around](http://github.com/ttscoff/doing/), I'll try to add mo
600
600
 
601
601
  ## Changelog
602
602
 
603
+ #### 1.0.24
604
+
605
+ - `doing note` operates on whatever is most recent, not just the last note in Currently
606
+ - `doing tag` with no count specified operates on most recent entry in any section, not just Currently
607
+ - `doing tag` with a count greater than 1 requires a section to be specified
608
+ - Improved results reporting for `doing tag`
609
+ - When removing tag do a whole-word match to avoid removing part of a longer tag
610
+
603
611
  #### 1.0.23
604
612
 
605
613
  - Apply default_tags after autotagging to avoid tags triggering tags
data/bin/doing CHANGED
@@ -124,13 +124,13 @@ command :note do |c|
124
124
  c.desc 'Section'
125
125
  c.arg_name 'section_name'
126
126
  c.default_value wwid.current_section
127
- c.flag [:s,:section], :default_value => wwid.current_section
127
+ c.flag [:s, :section], :default_value => "All"
128
128
 
129
129
  c.desc "Edit entry with #{ENV['EDITOR']}"
130
- c.switch [:e,:editor], :negatable => false, :default_value => false
130
+ c.switch [:e, :editor], :negatable => false, :default_value => false
131
131
 
132
132
  c.desc "Replace/Remove last entry's note"
133
- c.switch [:r,:remove], :negatable => false, :default_value => false
133
+ c.switch [:r, :remove], :negatable => false, :default_value => false
134
134
 
135
135
  c.action do |global_options,options,args|
136
136
  section = wwid.guess_section(options[:s]) || options[:s].cap_first
@@ -184,20 +184,20 @@ command :meanwhile do |c|
184
184
  c.desc 'Section'
185
185
  c.arg_name 'section_name'
186
186
  c.default_value wwid.current_section
187
- c.flag [:s,:section], :default_value => wwid.current_section
187
+ c.flag [:s, :section], :default_value => wwid.current_section
188
188
 
189
189
  c.desc "Edit entry with #{ENV['EDITOR']}"
190
- c.switch [:e,:editor]
190
+ c.switch [:e, :editor]
191
191
 
192
192
  c.desc "Archive previous @meanwhile entry"
193
- c.switch [:a,:archive], :default_value => false
193
+ c.switch [:a, :archive], :default_value => false
194
194
 
195
195
  c.desc 'Backdate start date for new entry to date string [4pm|20m|2h|yesterday noon]'
196
196
  c.flag [:back]
197
197
 
198
198
  c.desc 'Note'
199
199
  c.arg_name 'note_text'
200
- c.flag [:n,:note]
200
+ c.flag [:n, :note]
201
201
 
202
202
  c.action do |global_options,options,args|
203
203
  if options[:back]
@@ -237,7 +237,7 @@ long_desc %{
237
237
  command :templates do |c|
238
238
  c.desc "Type of template to output (HAML|CSS)"
239
239
  c.arg_name 'template_type'
240
- c.flag [:t,:type]
240
+ c.flag [:t, :type]
241
241
 
242
242
  c.action do |global_options,options,args|
243
243
  unless options[:type]
@@ -259,19 +259,19 @@ desc 'Add an item to the Later section'
259
259
  arg_name 'entry'
260
260
  command :later do |c|
261
261
  c.desc "Edit entry with #{ENV['EDITOR']}"
262
- c.switch [:e,:editor]
262
+ c.switch [:e, :editor]
263
263
 
264
264
  c.desc "Edit entry with specified app"
265
265
  c.arg_name 'editor_app'
266
266
  c.default_value wwid.config.has_key?('editor_app') && wwid.config['editor_app'] ? wwid.config['editor_app'] : false
267
- c.flag [:a,:app]
267
+ c.flag [:a, :app]
268
268
 
269
269
  c.desc 'Backdate start time to date string [4pm|20m|2h|yesterday noon]'
270
270
  c.flag [:back]
271
271
 
272
272
  c.desc 'Note'
273
273
  c.arg_name 'note_text'
274
- c.flag [:n,:note]
274
+ c.flag [:n, :note]
275
275
 
276
276
  c.action do |global_options,options,args|
277
277
  if options[:back]
@@ -317,25 +317,25 @@ arg_name 'entry'
317
317
  command :done do |c|
318
318
  c.desc 'Remove @done tag'
319
319
  c.default_value false
320
- c.switch [:r,:remove], :negatable => false, :default_value => false
320
+ c.switch [:r, :remove], :negatable => false, :default_value => false
321
321
 
322
322
  c.desc 'Include date'
323
323
  c.default_value true
324
- c.switch [:d,:date], :negatable => true, :default_value => true
324
+ c.switch [:d, :date], :negatable => true, :default_value => true
325
325
 
326
326
  c.desc 'Immediately archive the entry'
327
327
  c.default_value false
328
- c.switch [:a,:archive], :negatable => false, :default_value => false
328
+ c.switch [:a, :archive], :negatable => false, :default_value => false
329
329
 
330
330
  # TODO: Set @done date to specific time, backtracking start date in case of --took option. Should ignore --back option if present.
331
331
  # c.desc 'Set finish date to specific date/time (natural langauge)'
332
332
  # c.flag [:at]
333
333
 
334
334
  c.desc 'Backdate start date by interval [4pm|20m|2h|yesterday noon]'
335
- c.flag [:b,:back]
335
+ c.flag [:b, :back]
336
336
 
337
337
  c.desc 'Set completion date to start date plus interval (XX[mhd] or HH:MM). If used without the --back option, the start date will be moved back to allow the completion date to be the current time.'
338
- c.flag [:t,:took]
338
+ c.flag [:t, :took]
339
339
 
340
340
  c.desc 'Section'
341
341
  c.default_value wwid.current_section
@@ -475,8 +475,7 @@ desc 'Tag last entry'
475
475
  arg_name 'tag1 [tag2...]'
476
476
  command :tag do |c|
477
477
  c.desc 'Section'
478
- c.default_value wwid.current_section
479
- c.flag [:s,:section], :default_value => wwid.current_section
478
+ c.flag [:s,:section], :default_value => "All"
480
479
 
481
480
  c.desc 'How many recent entries to tag (0 for all)'
482
481
  c.default_value 1
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '1.0.23'
2
+ VERSION = '1.0.24'
3
3
  end
data/lib/doing/wwid.rb CHANGED
@@ -600,10 +600,18 @@ class WWID
600
600
  ## @brief Return the content of the last note for a given section
601
601
  ##
602
602
  ## @param section (String) The section to retrieve from, default
603
- ## Currently
603
+ ## All
604
604
  ##
605
- def last_note(section=@current_section)
605
+ def last_note(section="All")
606
606
  section = guess_section(section)
607
+ if section =~ /^all$/i
608
+ combined = {'items' => []}
609
+ @content.each {|k,v|
610
+ combined['items'] += v['items']
611
+ }
612
+ section = combined['items'].dup.sort_by{|item| item['date'] }.reverse[0]['section']
613
+ end
614
+
607
615
  if @content.has_key?(section)
608
616
  last_item = @content[section]['items'].dup.sort_by{|item| item['date'] }.reverse[0]
609
617
  $stderr.puts "Editing note for #{last_item['title']}"
@@ -636,12 +644,25 @@ class WWID
636
644
  sec_arr = [@current_section]
637
645
  elsif opt[:section].class == String
638
646
  if opt[:section] =~ /^all$/i
639
- sec_arr = sections
647
+ if opt[:count] == 1
648
+ combined = {'items' => []}
649
+ @content.each {|k,v|
650
+ combined['items'] += v['items']
651
+ }
652
+ items = combined['items'].dup.sort_by{|item| item['date'] }.reverse
653
+ sec_arr.push(items[0]['section'])
654
+ elsif opt[:count] > 1
655
+ raise "A count greater than one requires a section to be specified"
656
+ else
657
+ sec_arr = sections
658
+ end
640
659
  else
641
660
  sec_arr = [guess_section(opt[:section])]
642
661
  end
643
662
  end
644
663
 
664
+
665
+
645
666
  sec_arr.each {|section|
646
667
  if @content.has_key?(section)
647
668
 
@@ -668,9 +689,9 @@ class WWID
668
689
  opt[:tags].each {|tag|
669
690
  tag.strip!
670
691
  if opt[:remove]
671
- if title =~ /@#{tag}/
692
+ if title =~ /@#{tag}\b/
672
693
  title.gsub!(/(^| )@#{tag}(\([^\)]*\))?/,'')
673
- @results.push("Removed @#{tag}: #{title}")
694
+ @results.push(%Q{Removed @#{tag}: "#{title}" in #{section}})
674
695
  end
675
696
  else
676
697
  unless title =~ /@#{tag}/
@@ -680,7 +701,7 @@ class WWID
680
701
  else
681
702
  title += " @#{tag}"
682
703
  end
683
- @results.push("Added @#{tag}: #{title}")
704
+ @results.push(%Q{Added @#{tag}: "#{title}" in #{section}})
684
705
  end
685
706
  end
686
707
  }
@@ -707,7 +728,7 @@ class WWID
707
728
  @content['Archive']['items'] = archived
708
729
  # log it
709
730
  result = opt[:count] == 1 ? "1 entry" : "#{opt[:count]} entries"
710
- @results.push("Archived #{result}")
731
+ @results.push("Archived #{result} from #{section}")
711
732
  elsif opt[:archive] && opt[:count] == 0
712
733
  @results.push("Archiving is skipped when operating on all entries") if opt[:count] == 0
713
734
  end
@@ -722,13 +743,21 @@ class WWID
722
743
  ##
723
744
  ## @brief Add a note to the last entry in a section
724
745
  ##
725
- ## @param section (String) The section, default Currently
746
+ ## @param section (String) The section, default "All"
726
747
  ## @param note (String) The note to add
727
748
  ## @param replace (Bool) Should replace existing note
728
749
  ##
729
750
  def note_last(section, note, replace=false)
730
751
  section = guess_section(section)
731
752
 
753
+ if section =~ /^all$/i
754
+ combined = {'items' => []}
755
+ @content.each {|k,v|
756
+ combined['items'] += v['items']
757
+ }
758
+ section = combined['items'].dup.sort_by{|item| item['date'] }.reverse[0]['section']
759
+ end
760
+
732
761
  if @content.has_key?(section)
733
762
  # sort_section(opt[:section])
734
763
  items = @content[section]['items'].dup.sort_by{|item| item['date'] }.reverse
@@ -757,7 +786,7 @@ class WWID
757
786
 
758
787
  @content[section]['items'] = items
759
788
  else
760
- raise "Section not found"
789
+ raise "Section #{section} not found"
761
790
  end
762
791
  end
763
792
 
@@ -784,7 +813,6 @@ class WWID
784
813
  tag.sub!(/^@/,'')
785
814
 
786
815
  found_items = 0
787
- begin
788
816
  @content[opt[:section]]['items'].each_with_index {|item, i|
789
817
  if item['title'] =~ /@#{tag}/
790
818
  title = item['title'].gsub(/(^| )@(#{tag}|done)(\([^\)]*\))?/,'')
@@ -814,12 +842,6 @@ class WWID
814
842
  add_item(title.cap_first, opt[:section], {:note => note.join(' ').rstrip, :back => opt[:back]})
815
843
  end
816
844
 
817
- rescue Exception=>e
818
- puts e
819
- puts e.backtrace
820
- end
821
-
822
-
823
845
  write(@doing_file)
824
846
  end
825
847
 
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.23
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-09 00:00:00.000000000 Z
11
+ date: 2020-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake