na 1.1.15 → 1.1.17

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: d1f08f513ef3290991ee52c4688331b2725ddc192875bb28fea96f167da4c410
4
+ data.tar.gz: 7f354ea08863cc9c1c1df2b852fc8d6eb692d9a33dbf796f43e1e4bc639a27f1
5
5
  SHA512:
6
- metadata.gz: 22e0487072dde7c1bf2f76f412ae20a3018fd038300bdb2aac2557ac77ed1909006c4457debbe31c0c32db57439dff2ec7b07a23f8ebda96ad00748a575a8595
7
- data.tar.gz: 0e8175309ff9e1d43be62ec03cdd525e34b38c9ba9608e5edbfe90b97b315a43c397e7a318a624ba3f2fa210acc3f30bbadb47590de8a851fac4b092b133a327
6
+ metadata.gz: b74b4c889bfd689398064a826be50599a75f7306cd45acef3abfd5704d23a284abac6b655d9344ebfcec23ec283a52b891fd3426c8cbec6c90fe2ead70665f38
7
+ data.tar.gz: d960babf95647b691ecb5f16b93b7e872121c2208a79cfc2dab9be6d88479e59e8f3013697338e2dfd62f062dd1a4e07e335c46fedc41c6a1e2c440a4774a9c7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.1.17
2
+
3
+ 2022-10-06 17:02
4
+
5
+ #### CHANGED
6
+
7
+ - Default to AND search with `tagged` unless a "+" or "!" is specified
8
+
9
+ ### 1.1.16
10
+
11
+ 2022-10-06 16:47
12
+
13
+ #### NEW
14
+
15
+ - `--in todo/path` flag for `find` and `tagged` commands to specify a todo file from history
16
+
1
17
  ### 1.1.15
2
18
 
3
19
  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.17)
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.17
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]
@@ -327,19 +344,30 @@ class App
327
344
  end
328
345
 
329
346
  tags = []
347
+
348
+ all_req = args.join(' ') !~ /[+!\-]/
330
349
  args.join(',').split(/ *, */).each do |arg|
331
350
  # TODO: <> comparisons do nothing right now
332
- m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>*$\^]+)(?:(?<op>[=<>*$\^]+)(?<val>\S+))?$/)
351
+ m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>*$\^]+)(?:(?<op>[=<>*$\^]+)(?<val>.*?))?$/)
333
352
  tags.push({
334
353
  tag: m['tag'],
335
354
  comp: m['op'],
336
355
  value: m['val'],
337
- required: !m['req'].nil? && m['req'] == '+',
356
+ required: all_req || (!m['req'].nil? && m['req'] == '+'),
338
357
  negate: !m['req'].nil? && m['req'] =~ /[!\-]/
339
358
  })
340
359
  end
341
360
 
361
+ todo = nil
362
+ if options[:in]
363
+ todo = [{
364
+ token: options[:in],
365
+ required: true
366
+ }]
367
+ end
368
+
342
369
  files, actions = NA.parse_actions(depth: depth,
370
+ query: todo,
343
371
  tag: tags,
344
372
  negate: options[:invert],
345
373
  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.17'
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.16<!--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.17
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