na 1.1.15 → 1.1.16

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: d39a0b804774a7d07c6a1154e536798bdc2f09c20e76aa2ca776cc5111c02534
4
- data.tar.gz: 66e180d9cf673293e2721d83c8187b06746e352252c7fb1575be33032c088b89
3
+ metadata.gz: 53c4f2d9b3198892662e241d57c5d5bea699736112e91bba9551b7a393b57e06
4
+ data.tar.gz: 8bfd9f4bfbdd36bd0547a11e7ec88a43873f21aa1a3b9069020884a866646bdd
5
5
  SHA512:
6
- metadata.gz: 22e0487072dde7c1bf2f76f412ae20a3018fd038300bdb2aac2557ac77ed1909006c4457debbe31c0c32db57439dff2ec7b07a23f8ebda96ad00748a575a8595
7
- data.tar.gz: 0e8175309ff9e1d43be62ec03cdd525e34b38c9ba9608e5edbfe90b97b315a43c397e7a318a624ba3f2fa210acc3f30bbadb47590de8a851fac4b092b133a327
6
+ metadata.gz: 33855d0a87b71590afb538be498addfa793a13f3a6865b6c9ccfc1691ded319c98df726f4960f95d70202d38106ec5a1c728c29d40b3e477b597f873d289b3fc
7
+ data.tar.gz: ce9ac4455e0018b2ff8df66d93c938779f831b8db722551a525e8bf49c1240b51038420d46a60d1e76c7d4ccd0d1964eadcfd5d28020667fd2c5ab78e9f3f1cc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 1.1.16
2
+
3
+ 2022-10-06 16:47
4
+
5
+ #### NEW
6
+
7
+ - `--in todo/path` flag for `find` and `tagged` commands to specify a todo file from history
8
+
1
9
  ### 1.1.15
2
10
 
3
11
  2022-10-06 16:12
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.1.15)
4
+ na (1.1.16)
5
+ chronic (~> 0.10, >= 0.10.2)
5
6
  gli (~> 2.21.0)
6
7
  tty-reader (~> 0.9, >= 0.9.0)
7
8
  tty-screen (~> 0.8, >= 0.8.1)
@@ -10,6 +11,7 @@ PATH
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
14
+ chronic (0.10.2)
13
15
  gli (2.21.0)
14
16
  minitest (5.16.3)
15
17
  rake (0.9.6)
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  _If you're one of the rare people like me who find this useful, feel free to
10
10
  [buy me some coffee][donate]._
11
11
 
12
- The current version of `na` is 1.1.15
12
+ The current version of `na` is 1.1.16
13
13
  .
14
14
 
15
15
  `na` ("next action") is a command line tool designed to make it easy to see what your next actions are for any project, right from the command line. It works with TaskPaper-formatted files (but any plain text format will do), looking for `@na` tags (or whatever you specify) in todo files in your current folder.
data/bin/na CHANGED
@@ -249,6 +249,10 @@ class App
249
249
  c.arg_name 'DEPTH'
250
250
  c.flag %i[d depth], type: :integer, must_match: /^\d+$/
251
251
 
252
+ c.desc 'Show actions from a specific todo file in history'
253
+ c.arg_name 'TODO_PATH'
254
+ c.flag %i[in]
255
+
252
256
  c.desc 'Show actions from a specific project'
253
257
  c.arg_name 'PROJECT[/SUBPROJECT]'
254
258
  c.flag %i[proj project]
@@ -281,7 +285,16 @@ class App
281
285
  end
282
286
  end
283
287
 
288
+ todo = nil
289
+ if options[:in]
290
+ todo = [{
291
+ token: options[:in],
292
+ required: true
293
+ }]
294
+ end
295
+
284
296
  files, actions = NA.parse_actions(depth: depth,
297
+ query: todo,
285
298
  search: tokens,
286
299
  negate: options[:invert],
287
300
  regex: options[:regex],
@@ -312,6 +325,10 @@ class App
312
325
  c.default_value 1
313
326
  c.flag %i[d depth], type: :integer, must_match: /^\d+$/
314
327
 
328
+ c.desc 'Show actions from a specific todo file in history'
329
+ c.arg_name 'TODO_PATH'
330
+ c.flag %i[in]
331
+
315
332
  c.desc 'Show actions from a specific project'
316
333
  c.arg_name 'PROJECT[/SUBPROJECT]'
317
334
  c.flag %i[proj project]
@@ -329,7 +346,7 @@ class App
329
346
  tags = []
330
347
  args.join(',').split(/ *, */).each do |arg|
331
348
  # TODO: <> comparisons do nothing right now
332
- m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>*$\^]+)(?:(?<op>[=<>*$\^]+)(?<val>\S+))?$/)
349
+ m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>*$\^]+)(?:(?<op>[=<>*$\^]+)(?<val>.*?))?$/)
333
350
  tags.push({
334
351
  tag: m['tag'],
335
352
  comp: m['op'],
@@ -339,7 +356,16 @@ class App
339
356
  })
340
357
  end
341
358
 
359
+ todo = nil
360
+ if options[:in]
361
+ todo = [{
362
+ token: options[:in],
363
+ required: true
364
+ }]
365
+ end
366
+
342
367
  files, actions = NA.parse_actions(depth: depth,
368
+ query: todo,
343
369
  tag: tags,
344
370
  negate: options[:invert],
345
371
  project: options[:project],
data/lib/na/action.rb CHANGED
@@ -136,26 +136,54 @@ module NA
136
136
 
137
137
  return false if tag_val.nil?
138
138
 
139
- return case tag[:comp]
140
- when /^>$/
141
- tag_val.to_f > val.to_f
142
- when /^<$/
143
- tag_val.to_f < val.to_f
144
- when /^<=$/
145
- tag_val.to_f <= val.to_f
146
- when /^>=$/
147
- tag_val.to_f >= val.to_f
148
- when /^==?$/
149
- tag_val =~ /^#{val.wildcard_to_rx}$/
150
- when /^\$=$/
151
- tag_val =~ /#{val.wildcard_to_rx}$/i
152
- when /^\*=$/
153
- tag_val =~ /#{val.wildcard_to_rx}/i
154
- when /^\^=$/
155
- tag_val =~ /^#{val.wildcard_to_rx}/
156
- else
157
- false
158
- end
139
+ begin
140
+ tag_date = Time.parse(tag_val)
141
+ date = Chronic.parse(val)
142
+
143
+ puts "Comparing #{tag_date} #{tag[:comp]} #{date}" if NA.verbose
144
+
145
+ case tag[:comp]
146
+ when /^>$/
147
+ tag_date > date
148
+ when /^<$/
149
+ tag_date < date
150
+ when /^<=$/
151
+ tag_date <= date
152
+ when /^>=$/
153
+ tag_date >= date
154
+ when /^==?$/
155
+ tag_date == date
156
+ when /^\$=$/
157
+ tag_val =~ /#{val.wildcard_to_rx}/i
158
+ when /^\*=$/
159
+ tag_val =~ /#{val.wildcard_to_rx}/i
160
+ when /^\^=$/
161
+ tag_val =~ /^#{val.wildcard_to_rx}/
162
+ else
163
+ false
164
+ end
165
+ rescue
166
+ case tag[:comp]
167
+ when /^>$/
168
+ tag_val.to_f > val.to_f
169
+ when /^<$/
170
+ tag_val.to_f < val.to_f
171
+ when /^<=$/
172
+ tag_val.to_f <= val.to_f
173
+ when /^>=$/
174
+ tag_val.to_f >= val.to_f
175
+ when /^==?$/
176
+ tag_val =~ /^#{val.wildcard_to_rx}$/
177
+ when /^\$=$/
178
+ tag_val =~ /#{val.wildcard_to_rx}$/i
179
+ when /^\*=$/
180
+ tag_val =~ /#{val.wildcard_to_rx}/i
181
+ when /^\^=$/
182
+ tag_val =~ /^#{val.wildcard_to_rx}/
183
+ else
184
+ false
185
+ end
186
+ end
159
187
  end
160
188
 
161
189
  def scan_tags
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.1.15'
2
+ VERSION = '1.1.16'
3
3
  end
data/lib/na.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'na/version'
4
+ require 'time'
4
5
  require 'fileutils'
5
6
  require 'shellwords'
7
+ require 'chronic'
6
8
  require 'tty-screen'
7
9
  require 'tty-reader'
8
10
  require 'tty-which'
data/na.gemspec CHANGED
@@ -30,4 +30,5 @@ spec = Gem::Specification.new do |s|
30
30
  s.add_runtime_dependency('tty-reader', '~> 0.9', '>= 0.9.0')
31
31
  s.add_runtime_dependency('tty-screen', '~> 0.8', '>= 0.8.1')
32
32
  s.add_runtime_dependency('tty-which', '~> 0.5', '>= 0.5.0')
33
+ s.add_runtime_dependency('chronic', '~> 0.10', '>= 0.10.2')
33
34
  end
data/src/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  _If you're one of the rare people like me who find this useful, feel free to
10
10
  [buy me some coffee][donate]._
11
11
 
12
- The current version of `na` is <!--VER-->1.1.14<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.1.15<!--END VER-->.
13
13
 
14
14
  `na` ("next action") is a command line tool designed to make it easy to see what your next actions are for any project, right from the command line. It works with TaskPaper-formatted files (but any plain text format will do), looking for `@na` tags (or whatever you specify) in todo files in your current folder.
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.15
4
+ version: 1.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
@@ -146,6 +146,26 @@ dependencies:
146
146
  - - ">="
147
147
  - !ruby/object:Gem::Version
148
148
  version: 0.5.0
149
+ - !ruby/object:Gem::Dependency
150
+ name: chronic
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '0.10'
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: 0.10.2
159
+ type: :runtime
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '0.10'
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: 0.10.2
149
169
  description: A tool for managing a TaskPaper file of project todos for the current
150
170
  directory. Easily create "next actions" to come back to, add tags and priorities,
151
171
  and notes. Add prompt hooks to display your next actions automatically when cd'ing