doing 1.0.50 → 1.0.51

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: 37e84e7e125fd635921025a3c3f8a20a0987215eb551c9adf5ed4239bd276707
4
- data.tar.gz: 6a0c28fb01d02a27c51593793d37a4600d45370d7733180cad706dddbddf8715
3
+ metadata.gz: 03b16107627feaf0adeafbce9ad45e96fc53df7ba379f59dc72d2970d12642ef
4
+ data.tar.gz: 5cd54e6ba005e985b6c86468831d0b83369c5801916a9e8e15e742c86fcccf53
5
5
  SHA512:
6
- metadata.gz: 975ec56664d80ceb67f9087d3bc26fa347fb5c38ec3a1488834790a8ac5e8adc2c4c6df74c64ef23eca4689bb38120f9bccce19e1a38001116548a8fdbb587d9
7
- data.tar.gz: 8389272923846981d307dfc2f27737f478307b33f805d3eede7f476d07477037a75792f30116aee4d23e9627291546b81ddbe6a88dafba58958e135cd51d466f
6
+ metadata.gz: 617cd299b816ad12dc042ec76dbd58e5f19dca7098362ad4cc465d70d5c6dfab0e5ca4e05b82cd9535a85638ae490adea4da502ce4b6f0127e25da8f08b0bc6c
7
+ data.tar.gz: c82bb894c5d457d6bde4e6396cb7badffb4db3e6d0d81b75372f98968ec79b9ebfe15548b7040ddb5cc2eb2abfda2e3faaf6ea517c0485878689b50ce1739a79
data/README.md CHANGED
@@ -420,6 +420,7 @@ See `doing help meanwhile` for more options.
420
420
  #### Modifying entries:
421
421
 
422
422
  finish - Mark last X entries as @done
423
+ cancel - Mark last X entries as @done without completion date
423
424
  tag - Tag last entry
424
425
  note - Add a note to the last entry
425
426
 
@@ -431,6 +432,16 @@ See `doing help meanwhile` for more options.
431
432
 
432
433
  As mentioned above, `finish` also accepts `--back "2 hours"` (sets the finish date from time now minus interval) or `--took 30m` (sets the finish date to time started plus interval) so you can accurately add times to completed tasks, even if you don't do it in the moment.
433
434
 
435
+ Both `done` and `finish` accept an `--archive` switch which immediately moves the completed entries to the Archive section with a `@from(Project)` tag.
436
+
437
+ You can finish the last entry containing a specific tag or combination of tags using the `--tag` flag. Multiple tags are separated by commas. By default tags are combined with an AND boolean, meaning the entry must contain all specified tags to be considered. For example, to finish the last entry containing both "@work" and "@project1", you would use:
438
+
439
+ doing finish --tag=work,project1
440
+
441
+ You can change the boolean using `--tag_bool=OR` (last entry containing any of the specified tags) or `--tag_bool=NOT` (last entry containing none of the tags).
442
+
443
+ You can also include a `--no-date` switch to add `@done` without a finish date, meaning no time is tracked for the task. `doing cancel` is an alias for this. Like `finish`, `cancel` accepts a count to act on the last X entries, as well as `--archive` and `--section` options.
444
+
434
445
 
435
446
  ##### Tagging and Autotagging
436
447
 
data/bin/doing CHANGED
@@ -233,7 +233,7 @@ command :meanwhile do |c|
233
233
  input = false unless input && input.length > 0
234
234
 
235
235
  note = options[:n] ? options[:n] : false
236
- wwid.stop_start("meanwhile",{:new_item => input, :back => date, :section => section, :archive => options[:a], :note => note})
236
+ wwid.stop_start('meanwhile', {:new_item => input, :back => date, :section => section, :archive => options[:a], :note => note})
237
237
  wwid.write(wwid.doing_file)
238
238
  end
239
239
  end
@@ -422,6 +422,31 @@ command [:done, :did] do |c|
422
422
  end
423
423
  end
424
424
 
425
+ desc 'End last X entries with no time tracked'
426
+ long_desc 'Adds @done tag without datestamp so no elapsed time is recorded. Alias for `doing finish --no-date`.'
427
+ arg_name 'count'
428
+ command :cancel do |c|
429
+ c.desc 'Archive entries'
430
+ c.switch [:a, :archive], :negatable => false, :default_value => false
431
+
432
+ c.desc 'Section'
433
+ c.flag [:s, :section], :default_value => wwid.current_section
434
+
435
+ c.action do |global_options,options,args|
436
+
437
+ section = wwid.guess_section(options[:s]) || options[:s].cap_first
438
+
439
+ if args.length > 1
440
+ raise "Only one argument allowed"
441
+ elsif args.length == 0 || args[0] =~ /\d+/
442
+ count = args[0] ? args[0].to_i : 1
443
+ wwid.tag_last({:tags => ["done"], :count => count, :section => section, :archive => options[:a], :sequential => false, :date => false })
444
+ else
445
+ raise "Invalid argument (specify number of recent items to mark @done)"
446
+ end
447
+ end
448
+ end
449
+
425
450
  desc 'Mark last X entries as @done'
426
451
  long_desc 'Marks the last X entries with a @done tag and current date. Does not alter already completed entries.'
427
452
  arg_name 'count'
@@ -435,6 +460,12 @@ command :finish do |c|
435
460
  c.desc 'Set the completed date to the start date plus XX[hmd]'
436
461
  c.flag [:t, :took]
437
462
 
463
+ c.desc 'Finish the last X entries containing TAG. Separate multiple tags with comma (--tag=tag2,tag2)'
464
+ c.flag [:tag], :default_value => []
465
+
466
+ c.desc 'Boolean (AND|OR|NOT) with which to combine multiple tag filters'
467
+ c.flag [:tag_bool], default_value: 'AND'
468
+
438
469
  c.desc 'Auto-generate finish dates from next entry\'s start time. Automatically generate completion dates 1 minute before next start date. --auto overrides the --date and --back parameters.'
439
470
  c.switch [:auto], :negatable => false, :default_value => false
440
471
 
@@ -462,11 +493,20 @@ command :finish do |c|
462
493
  end
463
494
  end
464
495
 
496
+ if options[:tag]
497
+ options[:tag] = options[:tag].split(/,/).map {|tag| tag.strip.sub(/^@/, '') }
498
+ if options[:tag_bool] =~ /^(and|or|not)$/i
499
+ options[:tag_bool] = options[:tag_bool].upcase
500
+ else
501
+ options[:tag_bool] = 'AND'
502
+ end
503
+ end
504
+
465
505
  if args.length > 1
466
506
  raise "Only one argument allowed"
467
507
  elsif args.length == 0 || args[0] =~ /\d+/
468
508
  count = args[0] ? args[0].to_i : 1
469
- wwid.tag_last({:tags => ["done"], :count => count, :section => section, :archive => options[:a], :sequential => options[:auto], :date => options[:date], :back => date })
509
+ wwid.tag_last({ tags: ["done"],count: count,section: section,archive: options[:a],sequential: options[:auto],date: options[:date], back: date, tag: options[:tag], tag_bool: options[:tag_bool] })
470
510
  else
471
511
  raise "Invalid argument (specify number of recent items to mark @done)"
472
512
  end
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '1.0.50'
2
+ VERSION = '1.0.51'
3
3
  end
data/lib/doing/wwid.rb CHANGED
@@ -728,7 +728,6 @@ class WWID
728
728
  if @content.key?(section)
729
729
 
730
730
  items = @content[section]['items'].dup.sort_by { |item| item['date'] }.reverse
731
-
732
731
  index = 0
733
732
  done_date = Time.now
734
733
  next_start = Time.now
@@ -736,44 +735,80 @@ class WWID
736
735
  items.map! do |item|
737
736
  break if index == count
738
737
 
739
- if opt[:autotag]
740
- new_title = autotag(item['title']) if @auto_tag
741
- if new_title == item['title']
742
- @results.push(%(Autotag: No changes))
743
- else
744
- @results.push("Tags updated: #{new_title}")
745
- item['title'] = new_title
746
- end
747
- else
748
- if opt[:sequential]
749
- done_date = next_start - 1
750
- next_start = item['date']
751
- elsif opt[:back]
752
- done_date = item['date'] + (opt[:back] - item['date'])
738
+ tag_match = if opt[:tag].length.positive?
739
+ case opt[:tag_bool]
740
+ when 'AND'
741
+ result = true
742
+ opt[:tag].each do |tag|
743
+ unless item['title'] =~ /@#{tag}/
744
+ result = false
745
+ break
746
+ end
747
+ end
748
+ result
749
+ when 'NOT'
750
+ result = true
751
+ opt[:tag].each do |tag|
752
+ if item['title'] =~ /@#{tag}/
753
+ result = false
754
+ break
755
+ end
756
+ end
757
+ result
758
+ else
759
+ result = false
760
+ opt[:tag].each do |tag|
761
+ if item['title'] =~ /@#{tag}/
762
+ result = true
763
+ break
764
+ end
765
+ end
766
+ result
767
+ end
768
+ else
769
+ true
770
+ end
771
+
772
+ if tag_match
773
+ if opt[:autotag]
774
+ new_title = autotag(item['title']) if @auto_tag
775
+ if new_title == item['title']
776
+ @results.push(%(Autotag: No changes))
777
+ else
778
+ @results.push("Tags updated: #{new_title}")
779
+ item['title'] = new_title
780
+ end
753
781
  else
754
- done_date = Time.now
755
- end
782
+ if opt[:sequential]
783
+ done_date = next_start - 1
784
+ next_start = item['date']
785
+ elsif opt[:back]
786
+ done_date = item['date'] + (opt[:back] - item['date'])
787
+ else
788
+ done_date = Time.now
789
+ end
756
790
 
757
- title = item['title']
758
- opt[:tags].each do |tag|
759
- tag.strip!
760
- if opt[:remove] && title =~ /@#{tag}\b/
761
- title.gsub!(/(^| )@#{tag}(\([^)]*\))?/, '')
762
- @results.push(%(Removed @#{tag}: "#{title}" in #{section}))
763
- elsif title !~ /@#{tag}/
764
- title.chomp!
765
- title += if opt[:date]
766
- " @#{tag}(#{done_date.strftime('%F %R')})"
767
- else
768
- " @#{tag}"
769
- end
770
- @results.push(%(Added @#{tag}: "#{title}" in #{section}))
791
+ title = item['title']
792
+ opt[:tags].each do |tag|
793
+ tag.strip!
794
+ if opt[:remove] && title =~ /@#{tag}\b/
795
+ title.gsub!(/(^| )@#{tag}(\([^)]*\))?/, '')
796
+ @results.push(%(Removed @#{tag}: "#{title}" in #{section}))
797
+ elsif title !~ /@#{tag}/
798
+ title.chomp!
799
+ title += if opt[:date]
800
+ " @#{tag}(#{done_date.strftime('%F %R')})"
801
+ else
802
+ " @#{tag}"
803
+ end
804
+ @results.push(%(Added @#{tag}: "#{title}" in #{section}))
805
+ end
771
806
  end
807
+ item['title'] = title
772
808
  end
773
- item['title'] = title
774
- end
775
809
 
776
- index += 1
810
+ index += 1
811
+ end
777
812
 
778
813
  item
779
814
  end
@@ -783,9 +818,10 @@ class WWID
783
818
  if opt[:archive] && section != 'Archive' && (opt[:count]).positive?
784
819
  # concat [count] items from [section] and archive section
785
820
  archived = @content[section]['items'][0..opt[:count] - 1].map do |i|
786
- i['title'].sub(/(?:@from\(.*?\))?(.*)$/, "\\1 @from(#{i['section']})")
821
+ i['title'].sub!(/(?:@from\(.*?\))?(.*)$/, "\\1 @from(#{i['section']})")
822
+ i
787
823
  end.concat(@content['Archive']['items'])
788
- # chop [count] items off of [section] items
824
+ # slice [count] items off of [section] items
789
825
  @content[opt[:section]]['items'] = @content[opt[:section]]['items'][opt[:count]..-1]
790
826
  # overwrite archive section with concatenated array
791
827
  @content['Archive']['items'] = archived
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.50
4
+ version: 1.0.51
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-07-02 00:00:00.000000000 Z
11
+ date: 2021-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -78,20 +78,20 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '2.19'
81
+ version: '2.20'
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: 2.19.2
84
+ version: 2.20.1
85
85
  type: :runtime
86
86
  prerelease: false
87
87
  version_requirements: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '2.19'
91
+ version: '2.20'
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 2.19.2
94
+ version: 2.20.1
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: haml
97
97
  requirement: !ruby/object:Gem::Requirement