doing 1.0.68 → 1.0.69

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: acf8a6f7fcc6e38684720c4a4f28c00b03ad5e7d0d51a92c734f84254eeb6c1a
4
- data.tar.gz: 4cf29822709042f2744718ce5e525582408295f2300df8f962e32c9a788c339e
3
+ metadata.gz: bf5235acbab516c74ea7ff28c610dcbc49b9d9f108056c1b3c60ac0100bd9ec5
4
+ data.tar.gz: ca6abc5bd66a950d78ab16aabc781660b0ea5ee3f6dc50bb8a9fd0b986cce21e
5
5
  SHA512:
6
- metadata.gz: 9a76904bdca84e0bbc77694d0864d01a419ae6cd5c13aa42404b199bcb60d7421fcc58b02dd1373f1a81c8645815dbf43f958f43d52510f574fa9147c04cbfb3
7
- data.tar.gz: 1edaa81995c4b1ab77f5a0b4413b7961d47e67974a7201b623eb7d1727b274076e26a8a86a6ad1811ee6c2f8c9d3ac0786579097783eb5069feb045097527da2
6
+ metadata.gz: b9f62baa0a4348212c54c1f9f3aa5bca041d81bc5061221310a85747b05c0b9b7af9036d309fcffd78e192a7a415f462ceeb96f8c276cef320249651f4890d35
7
+ data.tar.gz: cc61feaf78e9a3d6865bbb3d5fecdff00659b9b00a7430971012bfca0856e45ee87efd864dde603a7a6e6abf6a571f01f0e8d60afbbb7ebe060364f65c908b6b
data/README.md CHANGED
@@ -29,7 +29,7 @@ _Side note:_ I actually use the library behind this utility as part of another s
29
29
 
30
30
  ## Installation
31
31
 
32
- The current version of `doing` is <!--VER-->1.0.67<!--END VER-->.
32
+ The current version of `doing` is <!--VER-->1.0.68<!--END VER-->.
33
33
 
34
34
  $ [sudo] gem install doing
35
35
 
@@ -464,6 +464,7 @@ You can also include a `--no-date` switch to add `@done` without a finish date,
464
464
 
465
465
  By default `doing finish` works on a single entry, the last entry or the most recent entry matching a `--tag` or `--search` query. Specifying `doing finish 10` would finish any unfinished entries within the last 10 entries. In the case of `--tag` or `--search` queries, the count serves as the maximum number of matches doing will act on, sorted in reverse date order (most recent first). A count of 0 will disable the limit entirely, acting on all matching entries.
466
466
 
467
+ Both `finish` and `cancel` accept `--unfinished` as an argument. This causes them to act on the last entry not already marked @done, no matter how far back it's dated or how many @done entries come after it. You can use `doing finish --unfinished X -s SECTION` to finish the last X unfinished entries in SECTION.
467
468
 
468
469
  ##### Tagging and Autotagging
469
470
 
data/bin/doing CHANGED
@@ -446,6 +446,9 @@ command :cancel do |c|
446
446
  c.arg_name 'BOOLEAN'
447
447
  c.flag [:bool], must_match: /(?:and|all|any|or|not|none)/i, default_value: 'AND'
448
448
 
449
+ c.desc 'Cancel last entry (or entries) not already marked @done'
450
+ c.switch %i[u unfinished], negatable: false, default_value: false
451
+
449
452
  c.action do |_global_options, options, args|
450
453
  section = wwid.guess_section(options[:s]) || options[:s].cap_first
451
454
 
@@ -478,7 +481,8 @@ command :cancel do |c|
478
481
  sequential: false,
479
482
  tag: tags,
480
483
  tag_bool: options[:bool],
481
- tags: ['done']
484
+ tags: ['done'],
485
+ unfinished: options[:unfinished]
482
486
  }
483
487
  wwid.tag_last(opts)
484
488
  end
@@ -512,6 +516,9 @@ command :finish do |c|
512
516
  c.arg_name 'BOOLEAN'
513
517
  c.flag [:bool], must_match: /(?:and|all|any|or|not|none)/i, default_value: 'AND'
514
518
 
519
+ c.desc 'Finish last entry (or entries) not already marked @done'
520
+ c.switch %i[u unfinished], negatable: false, default_value: false
521
+
515
522
  c.desc %(Auto-generate finish dates from next entry's start time.
516
523
  Automatically generate completion dates 1 minute before next start date.
517
524
  --auto overrides the --date and --back parameters.)
@@ -574,7 +581,8 @@ command :finish do |c|
574
581
  sequential: options[:auto],
575
582
  tag: tags,
576
583
  tag_bool: options[:bool],
577
- tags: ['done']
584
+ tags: ['done'],
585
+ unfinished: options[:unfinished]
578
586
  }
579
587
  wwid.tag_last(opts)
580
588
  end
@@ -648,6 +656,9 @@ command :tag do |c|
648
656
  c.desc 'Remove given tag(s)'
649
657
  c.switch %i[r remove], negatable: false, default_value: false
650
658
 
659
+ c.desc 'Tag last entry (or entries) not marked @done'
660
+ c.switch %i[u unfinished], negatable: false, default_value: false
661
+
651
662
  c.desc 'Autotag entries based on autotag configuration in ~/.doingrc'
652
663
  c.switch %i[a autotag], negatable: false, default_value: false
653
664
 
@@ -691,7 +702,8 @@ command :tag do |c|
691
702
  date: options[:date],
692
703
  remove: options[:r],
693
704
  section: section,
694
- tags: tags
705
+ tags: tags,
706
+ unfinished: options[:unfinished]
695
707
  }
696
708
  wwid.tag_last(opts)
697
709
  end
@@ -706,9 +718,17 @@ command [:mark, :flag] do |c|
706
718
  c.desc 'Remove mark'
707
719
  c.switch %i[r remove], negatable: false, default_value: false
708
720
 
721
+ c.desc 'Mark last entry not marked @done'
722
+ c.switch %i[u unfinished], negatable: false, default_value: false
723
+
709
724
  c.action do |_global_options, options, _args|
710
725
  mark = wwid.config['marker_tag'] || 'flagged'
711
- wwid.tag_last({ tags: [mark], section: options[:s], remove: options[:r] })
726
+ wwid.tag_last({
727
+ remove: options[:r],
728
+ section: options[:s],
729
+ tags: [mark],
730
+ unfinished: options[:unfinished]
731
+ })
712
732
  end
713
733
  end
714
734
 
data/lib/doing/helpers.rb CHANGED
@@ -6,6 +6,7 @@ class ::Hash
6
6
  tags = tags.split(/ *, */) if tags.is_a? String
7
7
  bool = bool.normalize_bool if bool.is_a? String
8
8
  item = self
9
+ tags.map! {|t| t.strip.sub(/^@/, '')}
9
10
  case bool
10
11
  when :and
11
12
  result = true
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '1.0.68'
2
+ VERSION = '1.0.69'
3
3
  end
data/lib/doing/wwid.rb CHANGED
@@ -781,6 +781,7 @@ class WWID
781
781
  opt[:autotag] ||= false
782
782
  opt[:back] ||= false
783
783
  opt[:took] ||= nil
784
+ opt[:unfinished] ||= false
784
785
 
785
786
  sec_arr = []
786
787
 
@@ -816,10 +817,11 @@ class WWID
816
817
  items.map! do |item|
817
818
  break if idx == count
818
819
 
820
+ finished = opt[:unfinished] && item.has_tags?('done', :and)
819
821
  tag_match = opt[:tag].nil? || opt[:tag].empty? ? true : item.has_tags?(opt[:tag], opt[:tag_bool])
820
822
  search_match = opt[:search].nil? || opt[:search].empty? ? true : item.matches_search?(opt[:search])
821
823
 
822
- if tag_match && search_match
824
+ if tag_match && search_match && !finished
823
825
  if opt[:autotag]
824
826
  new_title = autotag(item['title']) if @auto_tag
825
827
  if new_title == item['title']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.68
4
+ version: 1.0.69
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra