doing 1.0.35 → 1.0.40
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/bin/doing +66 -7
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +34 -17
- metadata +7 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9647740f610a441d3740aa8233e20cfa2b95cce65d047bf046233f7685b1936
|
4
|
+
data.tar.gz: 99a6dc7fcb96ca1e3a54cedc3e41be3f3d9bdd71f8c6d50c0d2aa4efc5c95ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53d0c3b2162eaf701b4b7df557446fdf12af0834e6083c7d59b4059f73f098c0339d5a2f72249981227c13f7b3f4f21b3f3cd6286260195a44e989b5899f5f66
|
7
|
+
data.tar.gz: 9249e276bfd117e47e10a4832ca5ccf376b425fe39ebd34574d0c66e1503483d02655a944dc8cd231106cbbecd39b0ad47ff357713fcbce1a50bf3ce04e555bb
|
data/bin/doing
CHANGED
@@ -604,6 +604,13 @@ command :show do |c|
|
|
604
604
|
c.default_value false
|
605
605
|
c.switch [:totals], :default_value => false, :negatable => true
|
606
606
|
|
607
|
+
c.desc 'Sort tags by (name|time)'
|
608
|
+
default = 'time'
|
609
|
+
if wwid.config.has_key?('tag_sort')
|
610
|
+
default = wwid.config['tag_sort']
|
611
|
+
end
|
612
|
+
c.flag [:tag_sort], :default_value => default
|
613
|
+
|
607
614
|
c.desc 'Only show items with recorded time intervals'
|
608
615
|
c.default_value false
|
609
616
|
c.switch [:only_timed], :default_value => false, :negatable => false
|
@@ -666,7 +673,9 @@ command :show do |c|
|
|
666
673
|
|
667
674
|
options[:t] = true if options[:totals]
|
668
675
|
|
669
|
-
|
676
|
+
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
677
|
+
|
678
|
+
puts wwid.list_section({:section => section, :date_filter => dates, :count => options[:c].to_i, :tag_filter => tag_filter, :age => options[:a], :order => options[:s], :output => options[:output], :times => options[:t], :totals => options[:totals], :sort_tags => options[:sort_tags], :highlight => true, :only_timed => options[:only_timed]})
|
670
679
|
|
671
680
|
end
|
672
681
|
end
|
@@ -690,6 +699,13 @@ command [:grep,:search] do |c|
|
|
690
699
|
c.default_value false
|
691
700
|
c.switch [:totals], :default_value => false, :negatable => true
|
692
701
|
|
702
|
+
c.desc 'Sort tags by (name|time)'
|
703
|
+
default = 'time'
|
704
|
+
if wwid.config.has_key?('tag_sort')
|
705
|
+
default = wwid.config['tag_sort']
|
706
|
+
end
|
707
|
+
c.flag [:tag_sort], :default_value => default
|
708
|
+
|
693
709
|
c.desc 'Only show items with recorded time intervals'
|
694
710
|
c.default_value false
|
695
711
|
c.switch [:only_timed], :default_value => false, :negatable => false
|
@@ -699,8 +715,9 @@ command [:grep,:search] do |c|
|
|
699
715
|
section = wwid.guess_section(options[:s]) if options[:s]
|
700
716
|
|
701
717
|
options[:t] = true if options[:totals]
|
718
|
+
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
702
719
|
|
703
|
-
puts wwid.list_section({:search => args.join(' '), :section => section, :output => options[:output], :times => options[:t], :highlight => true, :totals => options[:totals], :only_timed => options[:only_timed]})
|
720
|
+
puts wwid.list_section({:search => args.join(' '), :section => section, :output => options[:output], :times => options[:t], :highlight => true, :totals => options[:totals], :only_timed => options[:only_timed], :sort_tags => options[:sort_tags]})
|
704
721
|
|
705
722
|
end
|
706
723
|
end
|
@@ -721,6 +738,13 @@ command :recent do |c|
|
|
721
738
|
c.default_value false
|
722
739
|
c.switch [:totals], :default_value => false, :negatable => true
|
723
740
|
|
741
|
+
c.desc 'Sort tags by (name|time)'
|
742
|
+
default = 'time'
|
743
|
+
if wwid.config.has_key?('tag_sort')
|
744
|
+
default = wwid.config['tag_sort']
|
745
|
+
end
|
746
|
+
c.flag [:tag_sort], :default_value => default
|
747
|
+
|
724
748
|
c.action do |global_options,options,args|
|
725
749
|
|
726
750
|
section = wwid.guess_section(options[:s]) || options[:s].cap_first
|
@@ -732,8 +756,9 @@ command :recent do |c|
|
|
732
756
|
count = 10
|
733
757
|
end
|
734
758
|
options[:t] = true if options[:totals]
|
759
|
+
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
735
760
|
|
736
|
-
puts wwid.recent(count,section.cap_first,{ :times => options[:t], :totals => options[:totals] })
|
761
|
+
puts wwid.recent(count,section.cap_first,{ :times => options[:t], :totals => options[:totals], :sort_tags => options[:sort_tags] })
|
737
762
|
|
738
763
|
end
|
739
764
|
end
|
@@ -754,14 +779,22 @@ command :today do |c|
|
|
754
779
|
c.default_value false
|
755
780
|
c.switch [:totals], :default_value => false, :negatable => true
|
756
781
|
|
782
|
+
c.desc 'Sort tags by (name|time)'
|
783
|
+
default = 'time'
|
784
|
+
if wwid.config.has_key?('tag_sort')
|
785
|
+
default = wwid.config['tag_sort']
|
786
|
+
end
|
787
|
+
c.flag [:tag_sort], :default_value => default
|
788
|
+
|
757
789
|
c.desc 'Output to export format (csv|html|json)'
|
758
790
|
c.flag [:o,:output]
|
759
791
|
|
760
792
|
c.action do |global_options,options,args|
|
761
793
|
|
762
794
|
options[:t] = true if options[:totals]
|
795
|
+
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
763
796
|
|
764
|
-
puts wwid.today(options[:t],options[:output],{:totals => options[:totals], :section => options[:s]}).chomp
|
797
|
+
puts wwid.today(options[:t],options[:output],{:totals => options[:totals], :section => options[:s], :sort_tags => options[:sort_tags]}).chomp
|
765
798
|
|
766
799
|
end
|
767
800
|
end
|
@@ -783,6 +816,13 @@ command :on do |c|
|
|
783
816
|
c.default_value false
|
784
817
|
c.switch [:totals], :default_value => false, :negatable => true
|
785
818
|
|
819
|
+
c.desc 'Sort tags by (name|time)'
|
820
|
+
default = 'time'
|
821
|
+
if wwid.config.has_key?('tag_sort')
|
822
|
+
default = wwid.config['tag_sort']
|
823
|
+
end
|
824
|
+
c.flag [:tag_sort], :default_value => default
|
825
|
+
|
786
826
|
c.desc 'Output to export format (csv|html|json)'
|
787
827
|
c.flag [:o,:output]
|
788
828
|
|
@@ -806,8 +846,9 @@ command :on do |c|
|
|
806
846
|
wwid.results.push(message)
|
807
847
|
|
808
848
|
options[:t] = true if options[:totals]
|
849
|
+
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
809
850
|
|
810
|
-
puts wwid.list_date([start,finish],options[:s],options[:t],options[:output],{:totals => options[:totals]}).chomp
|
851
|
+
puts wwid.list_date([start, finish], options[:s], options[:t], options[:output], {:totals => options[:totals], :sort_tags => options[:sort_tags]}).chomp
|
811
852
|
|
812
853
|
end
|
813
854
|
end
|
@@ -830,8 +871,16 @@ command :yesterday do |c|
|
|
830
871
|
c.default_value false
|
831
872
|
c.switch [:totals], :default_value => false, :negatable => true
|
832
873
|
|
874
|
+
c.desc 'Sort tags by (name|time)'
|
875
|
+
default = 'time'
|
876
|
+
if wwid.config.has_key?('tag_sort')
|
877
|
+
default = wwid.config['tag_sort']
|
878
|
+
end
|
879
|
+
c.flag [:tag_sort], :default_value => default
|
880
|
+
|
833
881
|
c.action do |global_options, options,args|
|
834
|
-
|
882
|
+
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
883
|
+
puts wwid.yesterday(options[:s],options[:t],options[:o],{:totals => options[:totals], :sort_tags => options[:sort_tags]}).chomp
|
835
884
|
|
836
885
|
end
|
837
886
|
end
|
@@ -918,6 +967,13 @@ command :view do |c|
|
|
918
967
|
c.default_value false
|
919
968
|
c.switch [:totals], :default_value => false, :negatable => true
|
920
969
|
|
970
|
+
c.desc 'Sort tags by (name|time)'
|
971
|
+
default = 'time'
|
972
|
+
if wwid.config.has_key?('tag_sort')
|
973
|
+
default = wwid.config['tag_sort']
|
974
|
+
end
|
975
|
+
c.flag [:tag_sort], :default_value => default
|
976
|
+
|
921
977
|
c.desc 'Only show items with recorded time intervals'
|
922
978
|
c.default_value false
|
923
979
|
c.switch [:only_timed], :default_value => false, :negatable => true
|
@@ -963,9 +1019,12 @@ command :view do |c|
|
|
963
1019
|
count = options[:c] ? options[:c] : view.has_key?('count') ? view['count'] : 10
|
964
1020
|
section = options[:s] ? section : view.has_key?('section') ? view['section'] : wwid.current_section
|
965
1021
|
order = view.has_key?('order') ? view['order'] : "asc"
|
1022
|
+
|
966
1023
|
options[:t] = true if options[:totals]
|
967
1024
|
options[:output].downcase! if options[:output]
|
968
|
-
|
1025
|
+
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
1026
|
+
|
1027
|
+
puts wwid.list_section({:section => section, :count => count, :template => template, :format => format, :order => order, :tag_filter => tag_filter, :output => options[:o], :tags_color => tags_color, :times => options[:t], :highlight => true, :totals => options[:totals], :only_timed => only_timed, :sort_tags => options[:sort_tags] })
|
969
1028
|
else
|
970
1029
|
if title.class == FalseClass
|
971
1030
|
exit_now! "Cancelled"
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -188,6 +188,7 @@ class WWID
|
|
188
188
|
@config['marker_tag'] ||= 'flagged'
|
189
189
|
@config['marker_color'] ||= 'red'
|
190
190
|
@config['default_tags'] ||= []
|
191
|
+
@config['tag_sort'] ||= 'time'
|
191
192
|
|
192
193
|
@current_section = config['current_section']
|
193
194
|
@default_template = config['templates']['default']['template']
|
@@ -997,6 +998,7 @@ class WWID
|
|
997
998
|
opt[:tags_color] ||= false
|
998
999
|
opt[:times] ||= false
|
999
1000
|
opt[:totals] ||= false
|
1001
|
+
opt[:sort_tags] ||= false
|
1000
1002
|
opt[:search] ||= false
|
1001
1003
|
opt[:only_timed] ||= false
|
1002
1004
|
opt[:date_filter] ||= []
|
@@ -1180,7 +1182,7 @@ class WWID
|
|
1180
1182
|
out = {
|
1181
1183
|
'section' => section,
|
1182
1184
|
'items' => items_out,
|
1183
|
-
'timers' => tag_times("json")
|
1185
|
+
'timers' => tag_times("json", opt[:sort_tags])
|
1184
1186
|
}.to_json
|
1185
1187
|
elsif opt[:output] == "timeline"
|
1186
1188
|
template =<<EOTEMPLATE
|
@@ -1263,7 +1265,7 @@ EOTEMPLATE
|
|
1263
1265
|
style = css_template
|
1264
1266
|
end
|
1265
1267
|
|
1266
|
-
totals = opt[:totals] ? tag_times("html") : ""
|
1268
|
+
totals = opt[:totals] ? tag_times("html", opt[:sort_tags]) : ""
|
1267
1269
|
engine = Haml::Engine.new(template)
|
1268
1270
|
puts engine.render(Object.new, { :@items => items_out, :@page_title => page_title, :@style => style, :@totals => totals })
|
1269
1271
|
else
|
@@ -1353,7 +1355,7 @@ EOTEMPLATE
|
|
1353
1355
|
|
1354
1356
|
out += output + "\n"
|
1355
1357
|
}
|
1356
|
-
out += tag_times if opt[:totals]
|
1358
|
+
out += tag_times("text", opt[:sort_tags]) if opt[:totals]
|
1357
1359
|
end
|
1358
1360
|
return out
|
1359
1361
|
end
|
@@ -1526,8 +1528,10 @@ EOTEMPLATE
|
|
1526
1528
|
##
|
1527
1529
|
def today(times=true,output=nil,opt={})
|
1528
1530
|
opt[:totals] ||= false
|
1531
|
+
opt[:sort_tags] ||= false
|
1532
|
+
|
1529
1533
|
cfg = @config['templates']['today']
|
1530
|
-
list_section({:section => opt[:section], :wrap_width => cfg['wrap_width'], :count => 0, :format => cfg['date_format'], :template => cfg['template'], :order => "asc", :today => true, :times => times, :output => output, :totals => opt[:totals]})
|
1534
|
+
list_section({:section => opt[:section], :wrap_width => cfg['wrap_width'], :count => 0, :format => cfg['date_format'], :template => cfg['template'], :order => "asc", :today => true, :times => times, :output => output, :totals => opt[:totals], :sort_tags => opt[:sort_tags]})
|
1531
1535
|
end
|
1532
1536
|
|
1533
1537
|
##
|
@@ -1541,13 +1545,14 @@ EOTEMPLATE
|
|
1541
1545
|
##
|
1542
1546
|
def list_date(dates,section,times=nil,output=nil,opt={})
|
1543
1547
|
opt[:totals] ||= false
|
1548
|
+
opt[:sort_tags] ||= false
|
1544
1549
|
section = guess_section(section)
|
1545
1550
|
# :date_filter expects an array with start and end date
|
1546
1551
|
if dates.class == String
|
1547
1552
|
dates = [dates, dates]
|
1548
1553
|
end
|
1549
1554
|
|
1550
|
-
list_section({:section => section, :count => 0, :order => "asc", :date_filter => dates, :times => times, :output => output, :totals => opt[:totals] })
|
1555
|
+
list_section({:section => section, :count => 0, :order => "asc", :date_filter => dates, :times => times, :output => output, :totals => opt[:totals], :sort_tags => opt[:sort_tags] })
|
1551
1556
|
end
|
1552
1557
|
|
1553
1558
|
##
|
@@ -1560,8 +1565,9 @@ EOTEMPLATE
|
|
1560
1565
|
##
|
1561
1566
|
def yesterday(section,times=nil,output=nil,opt={})
|
1562
1567
|
opt[:totals] ||= false
|
1568
|
+
opt[:sort_tags] ||= false
|
1563
1569
|
section = guess_section(section)
|
1564
|
-
list_section({:section => section, :count => 0, :order => "asc", :yesterday => true, :times => times, :output => output, :totals => opt[:totals] })
|
1570
|
+
list_section({:section => section, :count => 0, :order => "asc", :yesterday => true, :times => times, :output => output, :totals => opt[:totals], :sort_tags => opt[:sort_tags] })
|
1565
1571
|
end
|
1566
1572
|
|
1567
1573
|
##
|
@@ -1574,10 +1580,12 @@ EOTEMPLATE
|
|
1574
1580
|
def recent(count=10,section=nil,opt={})
|
1575
1581
|
times = opt[:t] || true
|
1576
1582
|
opt[:totals] ||= false
|
1583
|
+
opt[:sort_tags] ||= false
|
1584
|
+
|
1577
1585
|
cfg = @config['templates']['recent']
|
1578
1586
|
section ||= @current_section
|
1579
1587
|
section = guess_section(section)
|
1580
|
-
list_section({:section => section, :wrap_width => cfg['wrap_width'], :count => count, :format => cfg['date_format'], :template => cfg['template'], :order => "asc", :times => times, :totals => opt[:totals] })
|
1588
|
+
list_section({:section => section, :wrap_width => cfg['wrap_width'], :count => count, :format => cfg['date_format'], :template => cfg['template'], :order => "asc", :times => times, :totals => opt[:totals], :sort_tags => opt[:sort_tags] })
|
1581
1589
|
end
|
1582
1590
|
|
1583
1591
|
##
|
@@ -1598,7 +1606,7 @@ EOTEMPLATE
|
|
1598
1606
|
##
|
1599
1607
|
## @param format (String) return format (html, json, or text)
|
1600
1608
|
##
|
1601
|
-
def tag_times(format="text")
|
1609
|
+
def tag_times(format="text", sort_by_name = false)
|
1602
1610
|
|
1603
1611
|
return "" if @timers.empty?
|
1604
1612
|
|
@@ -1606,6 +1614,13 @@ EOTEMPLATE
|
|
1606
1614
|
|
1607
1615
|
total = @timers.delete("All")
|
1608
1616
|
|
1617
|
+
tags_data = @timers.delete_if { |k,v| v == 0}
|
1618
|
+
if sort_by_name
|
1619
|
+
sorted_tags_data = tags_data.sort_by{|k,v| k }.reverse
|
1620
|
+
else
|
1621
|
+
sorted_tags_data = tags_data.sort_by{|k,v| v }
|
1622
|
+
end
|
1623
|
+
|
1609
1624
|
if format == "html"
|
1610
1625
|
output =<<EOS
|
1611
1626
|
<table>
|
@@ -1622,9 +1637,7 @@ EOTEMPLATE
|
|
1622
1637
|
</thead>
|
1623
1638
|
<tbody>
|
1624
1639
|
EOS
|
1625
|
-
|
1626
|
-
v
|
1627
|
-
}.reverse.each {|k,v|
|
1640
|
+
sorted_tags_data.reverse.each {|k,v|
|
1628
1641
|
output += "<tr><td style='text-align:left;'>#{k}</td><td style='text-align:left;'>#{"%02d:%02d:%02d" % fmt_time(v)}</td></tr>\n" if v > 0
|
1629
1642
|
}
|
1630
1643
|
tail =<<EOS
|
@@ -1643,7 +1656,7 @@ EOS
|
|
1643
1656
|
output + tail
|
1644
1657
|
elsif format == "json"
|
1645
1658
|
output = []
|
1646
|
-
|
1659
|
+
sorted_tags_data.reverse.each {|k,v|
|
1647
1660
|
output << {
|
1648
1661
|
'tag' => k,
|
1649
1662
|
'seconds' => v,
|
@@ -1653,7 +1666,7 @@ EOS
|
|
1653
1666
|
output
|
1654
1667
|
else
|
1655
1668
|
output = []
|
1656
|
-
|
1669
|
+
sorted_tags_data.reverse.each {|k,v|
|
1657
1670
|
spacer = ""
|
1658
1671
|
(max - k.length).times do
|
1659
1672
|
spacer += " "
|
@@ -1704,11 +1717,15 @@ EOS
|
|
1704
1717
|
regex = Regexp.new('@' + rx + '\b')
|
1705
1718
|
|
1706
1719
|
matches = text.scan(regex)
|
1707
|
-
|
1708
1720
|
matches.each {|m|
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1721
|
+
new_tag = r
|
1722
|
+
if m.kind_of?(Array)
|
1723
|
+
index = 1
|
1724
|
+
m.each {|v|
|
1725
|
+
new_tag = new_tag.sub('\\' + index.to_s, v)
|
1726
|
+
index = index + 1
|
1727
|
+
}
|
1728
|
+
end
|
1712
1729
|
tail_tags.push(new_tag)
|
1713
1730
|
} if matches
|
1714
1731
|
end
|
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.
|
4
|
+
version: 1.0.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -92,20 +92,20 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 5.
|
95
|
+
version: 5.0.0
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 5.
|
98
|
+
version: 5.0.0
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - "~>"
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 5.
|
105
|
+
version: 5.0.0
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: 5.
|
108
|
+
version: 5.0.0
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: chronic
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,26 +146,6 @@ dependencies:
|
|
146
146
|
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: 1.2.1
|
149
|
-
- !ruby/object:Gem::Dependency
|
150
|
-
name: json
|
151
|
-
requirement: !ruby/object:Gem::Requirement
|
152
|
-
requirements:
|
153
|
-
- - "~>"
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: 2.3.1
|
156
|
-
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: 1.8.1
|
159
|
-
type: :runtime
|
160
|
-
prerelease: false
|
161
|
-
version_requirements: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - "~>"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: 2.3.1
|
166
|
-
- - ">="
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: 1.8.1
|
169
149
|
description: A tool for managing a TaskPaper-like file of recent activites. Perfect
|
170
150
|
for the late-night hacker on too much caffeine to remember what they accomplished
|
171
151
|
at 2 in the morning.
|
@@ -210,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
190
|
- !ruby/object:Gem::Version
|
211
191
|
version: '0'
|
212
192
|
requirements: []
|
213
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.2.16
|
214
194
|
signing_key:
|
215
195
|
specification_version: 4
|
216
196
|
summary: A command line tool for managing What Was I Doing reminders
|