doing 2.0.3.pre → 2.0.5.pre

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: 2fa49c423dee61b9691c8b9c075d9f9dc366908783518e525ceda7c5aaad13d3
4
- data.tar.gz: '08b1a46254fd97c5c3e39d0f8450bd651714ea6c68c2c7c921a4a5a4aa8603fc'
3
+ metadata.gz: 8b6463637877fecac4b70b4df2e26f5fed8d2fb948433c9fbb43f7ffb32d4c20
4
+ data.tar.gz: 68003a5d25dede906536a36a87f96ac772d5d1cefcec6f25b3be5e7db3cfce2e
5
5
  SHA512:
6
- metadata.gz: c7efe2328eece13d03c13e62a86668229a110ceb0338145cf234cf9699c93070ccae0e52198c00b5c9789f50ac419a1f26952130a988a4594ddd4018ea217b50
7
- data.tar.gz: a9d6e519be45123d1303210e9af0835d7ef61ca7378ded0f0afd8eb4ef09c4879ee568e35d2159c26448d4ff93d1ee02ecdc8bcdfb6a0513b79cfbc774c1025c
6
+ metadata.gz: 3b7fc79db4221f6e7a4d6d923ad845b26f234d03fd4c16940ad046d94dd33321b645dc7447707b962142b7b559b08583d0dda8aecbf35c77db00d24ded68db1f
7
+ data.tar.gz: 782b17f9a291872c46bf704ea77d028a86d05461e5fc378431d8b16a95a6d55e8727c596c6c6f8c7ac1e469c0d85455dd67f38ae4dae2e565ae24fea0166dfc1
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ### 2.0.2.pre
1
+ ### 2.0.5.pre
2
+
3
+ #### NEW
4
+
5
+ - Add 'timer_format' config with 'human' option for tag totals
6
+
7
+ ### 2.0.3.pre
2
8
 
3
9
  #### NEW
4
10
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doing (2.0.2.pre)
4
+ doing (2.0.5.pre)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  deep_merge (~> 1.2, >= 1.2.1)
7
7
  gli (~> 2.19, >= 2.19.2)
data/README.md CHANGED
@@ -6,7 +6,7 @@ _If you're one of the rare people like me who find this useful, feel free to [bu
6
6
 
7
7
  <!--README-->
8
8
 
9
- The current version of `doing` is <!--VER-->2.0.0<!--END VER-->.
9
+ The current version of `doing` is <!--VER-->2.0.2<!--END VER-->.
10
10
 
11
11
  Find all of the documentation in the [doing wiki](https://github.com/ttscoff/doing/wiki).
12
12
 
data/bin/doing CHANGED
@@ -200,7 +200,7 @@ command %i[reset begin] do |c|
200
200
  c.flag [:bool], must_match: REGEX_BOOL, default_value: 'AND'
201
201
 
202
202
  c.desc 'Select from a menu of matching entries'
203
- c.switch %i[i interactive]
203
+ c.switch %i[i interactive], negatable: false, default_value: false
204
204
 
205
205
  c.action do |global_options, options, args|
206
206
  if options[:section]
@@ -271,7 +271,7 @@ command :note do |c|
271
271
  c.flag [:bool], must_match: REGEX_BOOL, default_value: 'AND'
272
272
 
273
273
  c.desc 'Select item for new note from a menu of matching entries'
274
- c.switch %i[i interactive]
274
+ c.switch %i[i interactive], negatable: false, default_value: false
275
275
 
276
276
  c.action do |_global_options, options, args|
277
277
  if options[:section]
@@ -774,7 +774,7 @@ command :cancel do |c|
774
774
  c.switch %i[u unfinished], negatable: false, default_value: false
775
775
 
776
776
  c.desc 'Select item(s) to cancel from a menu of matching entries'
777
- c.switch %i[i interactive]
777
+ c.switch %i[i interactive], negatable: false, default_value: false
778
778
 
779
779
  c.action do |_global_options, options, args|
780
780
  if options[:section]
@@ -867,7 +867,7 @@ command :finish do |c|
867
867
  c.flag %i[s section]
868
868
 
869
869
  c.desc 'Select item(s) to finish from a menu of matching entries'
870
- c.switch %i[i interactive]
870
+ c.switch %i[i interactive], negatable: false, default_value: false
871
871
 
872
872
  c.action do |_global_options, options, args|
873
873
  unless options[:auto]
@@ -963,7 +963,7 @@ command %i[again resume] do |c|
963
963
  c.flag %i[n note]
964
964
 
965
965
  c.desc 'Select item to resume from a menu of matching entries'
966
- c.switch %i[i interactive]
966
+ c.switch %i[i interactive], negatable: false, default_value: false
967
967
 
968
968
  c.action do |_global_options, options, _args|
969
969
  tags = options[:tag].nil? ? [] : options[:tag].to_tags
@@ -1042,7 +1042,7 @@ command :tag do |c|
1042
1042
  c.flag [:bool], must_match: REGEX_BOOL, default_value: 'AND'
1043
1043
 
1044
1044
  c.desc 'Select item(s) to tag from a menu of matching entries'
1045
- c.switch %i[i interactive]
1045
+ c.switch %i[i interactive], negatable: false, default_value: false
1046
1046
 
1047
1047
  c.action do |_global_options, options, args|
1048
1048
  raise Doing::Errors::MissingArgument, 'You must specify at least one tag' if args.empty? && !options[:a]
@@ -1170,7 +1170,7 @@ command [:mark, :flag] do |c|
1170
1170
  c.flag [:bool], must_match: REGEX_BOOL, default_value: 'AND'
1171
1171
 
1172
1172
  c.desc 'Select item(s) to flag from a menu of matching entries'
1173
- c.switch %i[i interactive]
1173
+ c.switch %i[i interactive], negatable: false, default_value: false
1174
1174
 
1175
1175
  c.action do |_global_options, options, _args|
1176
1176
  mark = settings['marker_tag'] || 'flagged'
@@ -1302,7 +1302,7 @@ command :show do |c|
1302
1302
  c.switch [:only_timed], default_value: false, negatable: false
1303
1303
 
1304
1304
  c.desc 'Select from a menu of matching entries to perform additional operations'
1305
- c.switch %i[i interactive]
1305
+ c.switch %i[i interactive], negatable: false, default_value: false
1306
1306
 
1307
1307
  c.desc "Output to export format (#{Doing::Plugins.plugin_names(type: :export)})"
1308
1308
  c.arg_name 'FORMAT'
@@ -1476,7 +1476,7 @@ command :recent do |c|
1476
1476
  c.flag [:tag_sort], must_match: /^(?:name|time)$/i, default_value: default
1477
1477
 
1478
1478
  c.desc 'Select from a menu of matching entries to perform additional operations'
1479
- c.switch %i[i interactive]
1479
+ c.switch %i[i interactive], negatable: false, default_value: false
1480
1480
 
1481
1481
  c.action do |global_options, options, args|
1482
1482
  section = wwid.guess_section(options[:s]) || options[:s].cap_first
@@ -1923,7 +1923,7 @@ command :view do |c|
1923
1923
  c.switch [:only_timed], default_value: false, negatable: false
1924
1924
 
1925
1925
  c.desc 'Select from a menu of matching entries to perform additional operations'
1926
- c.switch %i[i interactive]
1926
+ c.switch %i[i interactive], negatable: false, default_value: false
1927
1927
 
1928
1928
  c.action do |_global_options, options, args|
1929
1929
  raise InvalidExportType, "Invalid export type: #{options[:output]}" if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
data/doing.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Doing uses a TaskPaper-like formatting to keep a plain text record of what you've been doing, complete with tag-based time tracking. The command line tool allows you to add entries, annotate with tags and notes, and view your entries with myriad options, with a focus on a "natural" language syntax.
4
4
 
5
- v2.0.2.pre
5
+ v2.0.5.pre
6
6
 
7
7
  === Global Options
8
8
  === --config_file arg
@@ -128,7 +128,7 @@ Edit duplicated entry with vim before adding
128
128
 
129
129
 
130
130
 
131
- ===== -i|--[no-]interactive
131
+ ===== -i|--interactive
132
132
  Select item to resume from a menu of matching entries
133
133
 
134
134
 
@@ -223,7 +223,7 @@ Archive entries
223
223
 
224
224
 
225
225
 
226
- ===== -i|--[no-]interactive
226
+ ===== -i|--interactive
227
227
  Select item(s) to cancel from a menu of matching entries
228
228
 
229
229
 
@@ -439,7 +439,7 @@ Include date
439
439
 
440
440
 
441
441
 
442
- ===== -i|--[no-]interactive
442
+ ===== -i|--interactive
443
443
  Select item(s) to finish from a menu of matching entries
444
444
 
445
445
 
@@ -721,7 +721,7 @@ Don't ask permission to flag all entries when count is 0
721
721
 
722
722
 
723
723
 
724
- ===== -i|--[no-]interactive
724
+ ===== -i|--interactive
725
725
  Select item(s) to flag from a menu of matching entries
726
726
 
727
727
 
@@ -815,7 +815,7 @@ Edit entry with vim
815
815
 
816
816
 
817
817
 
818
- ===== -i|--[no-]interactive
818
+ ===== -i|--interactive
819
819
  Select item for new note from a menu of matching entries
820
820
 
821
821
 
@@ -965,7 +965,7 @@ Sort tags by (name|time)
965
965
  [Must Match] (?i-mx:^(?:name|time)$)
966
966
 
967
967
 
968
- ===== -i|--[no-]interactive
968
+ ===== -i|--interactive
969
969
  Select from a menu of matching entries to perform additional operations
970
970
 
971
971
 
@@ -1014,7 +1014,7 @@ Reset last entry matching tag
1014
1014
  [Default Value] None
1015
1015
 
1016
1016
 
1017
- ===== -i|--[no-]interactive
1017
+ ===== -i|--interactive
1018
1018
  Select from a menu of matching entries
1019
1019
 
1020
1020
 
@@ -1281,7 +1281,7 @@ Sort tags by (name|time)
1281
1281
  [Must Match] (?i-mx:^(?:name|time))
1282
1282
 
1283
1283
 
1284
- ===== -i|--[no-]interactive
1284
+ ===== -i|--interactive
1285
1285
  Select from a menu of matching entries to perform additional operations
1286
1286
 
1287
1287
 
@@ -1416,7 +1416,7 @@ Don't ask permission to tag all entries when count is 0
1416
1416
 
1417
1417
 
1418
1418
 
1419
- ===== -i|--[no-]interactive
1419
+ ===== -i|--interactive
1420
1420
  Select item(s) to tag from a menu of matching entries
1421
1421
 
1422
1422
 
@@ -1605,7 +1605,7 @@ Include colors in output
1605
1605
 
1606
1606
 
1607
1607
 
1608
- ===== -i|--[no-]interactive
1608
+ ===== -i|--interactive
1609
1609
  Select from a menu of matching entries to perform additional operations
1610
1610
 
1611
1611
 
data/example_plugin.rb CHANGED
@@ -150,7 +150,7 @@ module Doing
150
150
  finished_at = i.end_date
151
151
  took += finished_at.strftime('%A %B %e at %I:%M%p')
152
152
 
153
- d, h, m = wwid.fmt_time(interval)
153
+ d, h, m = wwid.format_time(interval)
154
154
  took += ' and it took'
155
155
  took += " #{d.to_i} days" if d.to_i.positive?
156
156
  took += " #{h.to_i} hours" if h.to_i.positive?
@@ -31,6 +31,8 @@ module Doing
31
31
  'never_time' => [],
32
32
  'never_finish' => [],
33
33
 
34
+ 'timer_format' => 'text',
35
+
34
36
  'templates' => {
35
37
  'default' => {
36
38
  'date_format' => '%Y-%m-%d %H:%M',
@@ -56,7 +56,7 @@ module Doing
56
56
  end_date: end_date,
57
57
  title: title.strip, #+ " #{note}"
58
58
  note: note.instance_of?(Array) ? note.to_s : note,
59
- time: '%02d:%02d:%02d' % wwid.fmt_time(interval),
59
+ time: '%02d:%02d:%02d' % wwid.format_time(interval),
60
60
  tags: tags
61
61
  }
62
62
 
@@ -68,7 +68,7 @@ module Doing
68
68
  new_item = {
69
69
  'id' => index + 1,
70
70
  'content' => title.strip, #+ " #{note}"
71
- 'title' => title.strip + " (#{'%02d:%02d:%02d' % wwid.fmt_time(interval)})",
71
+ 'title' => title.strip + " (#{'%02d:%02d:%02d' % wwid.format_time(interval)})",
72
72
  'start' => i.date.strftime('%F %T'),
73
73
  'type' => 'box',
74
74
  'style' => 'color:#4c566b;background-color:#d8dee9;'
@@ -132,7 +132,7 @@ module Doing
132
132
  out += "#{output}\n"
133
133
  end
134
134
  # Doing.logger.debug('Template Export:', "#{items.count} items output to template #{opt[:template]}")
135
- out += wwid.tag_times(format: :text, sort_by_name: opt[:sort_tags], sort_order: opt[:tag_order]) if opt[:totals]
135
+ out += wwid.tag_times(format: wwid.config['timer_format'].to_sym, sort_by_name: opt[:sort_tags], sort_order: opt[:tag_order]) if opt[:totals]
136
136
  out
137
137
  end
138
138
 
data/lib/doing/string.rb CHANGED
@@ -255,6 +255,7 @@ module Doing
255
255
  else
256
256
  add = tag
257
257
  add += "(#{value})" unless value.nil?
258
+ title.chomp!
258
259
  title += " @#{add}"
259
260
 
260
261
  title.dedup_tags!
@@ -262,7 +263,7 @@ module Doing
262
263
  # Doing.logger.debug('Added tag:', %(#{('@' + tag).cyan} to "#{title}"))
263
264
  end
264
265
 
265
- title
266
+ title.gsub(/ +/, ' ')
266
267
  end
267
268
 
268
269
  ##
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.0.3.pre'
2
+ VERSION = '2.0.5.pre'
3
3
  end
data/lib/doing/wwid.rb CHANGED
@@ -1178,6 +1178,7 @@ module Doing
1178
1178
  else
1179
1179
  old_title = item.title.dup
1180
1180
  should_date = opt[:date] && item.should_time?
1181
+ item.title.tag!('done', remove: true) if tag =~ /done/ && !should_date
1181
1182
  item.title.tag!(tag, value: should_date ? done_date.strftime('%F %R') : nil)
1182
1183
  added << tag if old_title != item.title
1183
1184
  end
@@ -1997,7 +1998,7 @@ module Doing
1997
1998
  EOS
1998
1999
  sorted_tags_data.reverse.each do |k, v|
1999
2000
  if v > 0
2000
- output += "<tr><td style='text-align:left;'>#{k}</td><td style='text-align:left;'>#{'%02d:%02d:%02d' % fmt_time(v)}</td></tr>\n"
2001
+ output += "<tr><td style='text-align:left;'>#{k}</td><td style='text-align:left;'>#{'%02d:%02d:%02d' % format_time(v)}</td></tr>\n"
2001
2002
  end
2002
2003
  end
2003
2004
  tail = <<EOS
@@ -2008,7 +2009,7 @@ EOS
2008
2009
  <tfoot>
2009
2010
  <tr>
2010
2011
  <td style="text-align:left;"><strong>Total</strong></td>
2011
- <td style="text-align:left;">#{'%02d:%02d:%02d' % fmt_time(total)}</td>
2012
+ <td style="text-align:left;">#{'%02d:%02d:%02d' % format_time(total)}</td>
2012
2013
  </tr>
2013
2014
  </tfoot>
2014
2015
  </table>
@@ -2022,7 +2023,7 @@ EOS
2022
2023
  EOS
2023
2024
  sorted_tags_data.reverse.each do |k, v|
2024
2025
  if v > 0
2025
- output += "| #{' ' * (pad - k.length)}#{k} | #{'%02d:%02d:%02d' % fmt_time(v)} |\n"
2026
+ output += "| #{' ' * (pad - k.length)}#{k} | #{'%02d:%02d:%02d' % format_time(v)} |\n"
2026
2027
  end
2027
2028
  end
2028
2029
  tail = "[Tag Totals]"
@@ -2030,7 +2031,7 @@ EOS
2030
2031
  when :json
2031
2032
  output = []
2032
2033
  sorted_tags_data.reverse.each do |k, v|
2033
- d, h, m = fmt_time(v)
2034
+ d, h, m = format_time(v)
2034
2035
  output << {
2035
2036
  'tag' => k,
2036
2037
  'seconds' => v,
@@ -2038,6 +2039,39 @@ EOS
2038
2039
  }
2039
2040
  end
2040
2041
  output
2042
+ when :human
2043
+ output = []
2044
+ sorted_tags_data.reverse.each do |k, v|
2045
+ spacer = ''
2046
+ (max - k.length).times do
2047
+ spacer += ' '
2048
+ end
2049
+ d, h, m = format_time(v, human: true)
2050
+ output.push("┃ #{spacer}#{k}:#{format('%<h> 4dh %<m>02dm', h: h, m: m)} ┃")
2051
+ end
2052
+
2053
+ header = '┏━━ Tag Totals '
2054
+ (max - 2).times { header += '━' }
2055
+ header += '┓'
2056
+ footer = '┗'
2057
+ (max + 12).times { footer += '━' }
2058
+ footer += '┛'
2059
+ divider = '┣'
2060
+ (max + 12).times { divider += '━' }
2061
+ divider += '┫'
2062
+ output = output.empty? ? '' : "\n#{header}\n#{output.join("\n")}"
2063
+ d, h, m = format_time(total, human: true)
2064
+ output += "\n#{divider}"
2065
+ spacer = ''
2066
+ (max - 6).times do
2067
+ spacer += ' '
2068
+ end
2069
+ total = "┃ #{spacer}total: "
2070
+ total += format('%<h> 4dh %<m>02dm', h: h, m: m)
2071
+ total += ' ┃'
2072
+ output += "\n#{total}"
2073
+ output += "\n#{footer}"
2074
+ output
2041
2075
  else
2042
2076
  output = []
2043
2077
  sorted_tags_data.reverse.each do |k, v|
@@ -2045,12 +2079,12 @@ EOS
2045
2079
  (max - k.length).times do
2046
2080
  spacer += ' '
2047
2081
  end
2048
- d, h, m = fmt_time(v)
2082
+ d, h, m = format_time(v)
2049
2083
  output.push("#{k}:#{spacer}#{format('%<d>02d:%<h>02d:%<m>02d', d: d, h: h, m: m)}")
2050
2084
  end
2051
2085
 
2052
2086
  output = output.empty? ? '' : "\n--- Tag Totals ---\n#{output.join("\n")}"
2053
- d, h, m = fmt_time(total)
2087
+ d, h, m = format_time(total)
2054
2088
  output += "\n\nTotal tracked: #{format('%<d>02d:%<h>02d:%<m>02d', d: d, h: h, m: m)}\n"
2055
2089
  output
2056
2090
  end
@@ -2076,7 +2110,7 @@ EOS
2076
2110
  record_tag_times(item, seconds) if record
2077
2111
  return seconds.positive? ? seconds : false unless formatted
2078
2112
 
2079
- return seconds.positive? ? format('%02d:%02d:%02d', *fmt_time(seconds)) : false
2113
+ return seconds.positive? ? format('%02d:%02d:%02d', *format_time(seconds)) : false
2080
2114
  end
2081
2115
 
2082
2116
  false
@@ -2106,7 +2140,7 @@ EOS
2106
2140
  ##
2107
2141
  ## @param seconds The seconds
2108
2142
  ##
2109
- def fmt_time(seconds)
2143
+ def format_time(seconds, human: false)
2110
2144
  return [0, 0, 0] if seconds.nil?
2111
2145
 
2112
2146
  if seconds.class == String && seconds =~ /(\d+):(\d+):(\d+)/
@@ -2117,10 +2151,15 @@ EOS
2117
2151
  end
2118
2152
  minutes = (seconds / 60).to_i
2119
2153
  hours = (minutes / 60).to_i
2120
- days = (hours / 24).to_i
2121
- hours = (hours % 24).to_i
2122
- minutes = (minutes % 60).to_i
2123
- [days, hours, minutes]
2154
+ if human
2155
+ minutes = (minutes % 60).to_i
2156
+ [0, hours, minutes]
2157
+ else
2158
+ days = (hours / 24).to_i
2159
+ hours = (hours % 24).to_i
2160
+ minutes = (minutes % 60).to_i
2161
+ [days, hours, minutes]
2162
+ end
2124
2163
  end
2125
2164
 
2126
2165
  private
@@ -75,6 +75,7 @@ command :wiki do |c|
75
75
  File.open(File.join('doing_wiki', 'index.html'), 'w') do |f|
76
76
  f.puts index_out
77
77
  end
78
+ Doing.logger.warn("Wiki written to doing_wiki directory")
78
79
  end
79
80
  end
80
81
  end
@@ -149,7 +149,7 @@ module Doing
149
149
  finished_at = i.end_date
150
150
  took += finished_at.strftime('%A %B %e at %I:%M%p')
151
151
 
152
- d, h, m = wwid.fmt_time(interval)
152
+ d, h, m = wwid.format_time(interval)
153
153
  took += ' and it took'
154
154
  took += " #{d.to_i} days" if d.to_i.positive?
155
155
  took += " #{h.to_i} hours" if h.to_i.positive?
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: 2.0.3.pre
4
+ version: 2.0.5.pre
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-11-17 00:00:00.000000000 Z
11
+ date: 2021-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml