na 1.1.14 → 1.1.16
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/CHANGELOG.md +24 -0
- data/Gemfile.lock +3 -1
- data/README.md +1 -1
- data/bin/na +36 -3
- data/lib/na/action.rb +48 -20
- data/lib/na/string.rb +10 -4
- data/lib/na/version.rb +1 -1
- data/lib/na.rb +2 -0
- data/na.gemspec +1 -0
- data/src/README.md +1 -1
- metadata +21 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53c4f2d9b3198892662e241d57c5d5bea699736112e91bba9551b7a393b57e06
|
4
|
+
data.tar.gz: 8bfd9f4bfbdd36bd0547a11e7ec88a43873f21aa1a3b9069020884a866646bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33855d0a87b71590afb538be498addfa793a13f3a6865b6c9ccfc1691ded319c98df726f4960f95d70202d38106ec5a1c728c29d40b3e477b597f873d289b3fc
|
7
|
+
data.tar.gz: ce9ac4455e0018b2ff8df66d93c938779f831b8db722551a525e8bf49c1240b51038420d46a60d1e76c7d4ccd0d1964eadcfd5d28020667fd2c5ab78e9f3f1cc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
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
|
+
|
9
|
+
### 1.1.15
|
10
|
+
|
11
|
+
2022-10-06 16:12
|
12
|
+
|
13
|
+
#### CHANGED
|
14
|
+
|
15
|
+
- If no + or ! tokens are given in search, default to AND search for tokens
|
16
|
+
|
17
|
+
#### IMPROVED
|
18
|
+
|
19
|
+
- Better handling of color in search highlighting
|
20
|
+
|
21
|
+
#### FIXED
|
22
|
+
|
23
|
+
- --regex search broken
|
24
|
+
|
1
25
|
### 1.1.14
|
2
26
|
|
3
27
|
2022-10-06 12:30
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
na (1.1.
|
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.
|
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]
|
@@ -269,23 +273,39 @@ class App
|
|
269
273
|
tokens = Regexp.new(args.join(' '), Regexp::IGNORECASE)
|
270
274
|
else
|
271
275
|
tokens = []
|
276
|
+
all_req = args.join(' ') !~ /[+!\-]/
|
277
|
+
|
272
278
|
args.join(' ').split(/ /).each do |arg|
|
273
279
|
m = arg.match(/^(?<req>[+\-!])?(?<tok>.*?)$/)
|
274
280
|
tokens.push({
|
275
281
|
token: m['tok'],
|
276
|
-
required: !m['req'].nil? && m['req'] == '+',
|
282
|
+
required: all_req || (!m['req'].nil? && m['req'] == '+'),
|
277
283
|
negate: !m['req'].nil? && m['req'] =~ /[!\-]/
|
278
284
|
})
|
279
285
|
end
|
280
286
|
end
|
281
287
|
|
288
|
+
todo = nil
|
289
|
+
if options[:in]
|
290
|
+
todo = [{
|
291
|
+
token: options[:in],
|
292
|
+
required: true
|
293
|
+
}]
|
294
|
+
end
|
295
|
+
|
282
296
|
files, actions = NA.parse_actions(depth: depth,
|
297
|
+
query: todo,
|
283
298
|
search: tokens,
|
284
299
|
negate: options[:invert],
|
285
300
|
regex: options[:regex],
|
286
301
|
project: options[:project],
|
287
302
|
require_na: false)
|
288
|
-
|
303
|
+
if tokens.is_a?(Array)
|
304
|
+
regexes = tokens.delete_if { |token| token[:negate] }.map { |token| token[:token] }
|
305
|
+
else
|
306
|
+
regexes = [tokens]
|
307
|
+
end
|
308
|
+
|
289
309
|
NA.output_actions(actions, depth, files: files, regexes: regexes)
|
290
310
|
end
|
291
311
|
end
|
@@ -305,6 +325,10 @@ class App
|
|
305
325
|
c.default_value 1
|
306
326
|
c.flag %i[d depth], type: :integer, must_match: /^\d+$/
|
307
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
|
+
|
308
332
|
c.desc 'Show actions from a specific project'
|
309
333
|
c.arg_name 'PROJECT[/SUBPROJECT]'
|
310
334
|
c.flag %i[proj project]
|
@@ -322,7 +346,7 @@ class App
|
|
322
346
|
tags = []
|
323
347
|
args.join(',').split(/ *, */).each do |arg|
|
324
348
|
# TODO: <> comparisons do nothing right now
|
325
|
-
m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>*$\^]+)(?:(?<op>[=<>*$\^]+)(?<val
|
349
|
+
m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>*$\^]+)(?:(?<op>[=<>*$\^]+)(?<val>.*?))?$/)
|
326
350
|
tags.push({
|
327
351
|
tag: m['tag'],
|
328
352
|
comp: m['op'],
|
@@ -332,7 +356,16 @@ class App
|
|
332
356
|
})
|
333
357
|
end
|
334
358
|
|
359
|
+
todo = nil
|
360
|
+
if options[:in]
|
361
|
+
todo = [{
|
362
|
+
token: options[:in],
|
363
|
+
required: true
|
364
|
+
}]
|
365
|
+
end
|
366
|
+
|
335
367
|
files, actions = NA.parse_actions(depth: depth,
|
368
|
+
query: todo,
|
336
369
|
tag: tags,
|
337
370
|
negate: options[:invert],
|
338
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
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
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/string.rb
CHANGED
@@ -15,7 +15,7 @@ class ::String
|
|
15
15
|
##
|
16
16
|
## @return [String] string with @tags highlighted
|
17
17
|
##
|
18
|
-
def highlight_tags(color: '{m}', value: '{y}', parens: '{m}', last_color: '{
|
18
|
+
def highlight_tags(color: '{m}', value: '{y}', parens: '{m}', last_color: '{xg}')
|
19
19
|
tag_color = NA::Color.template(color)
|
20
20
|
paren_color = NA::Color.template(parens)
|
21
21
|
value_color = NA::Color.template(value)
|
@@ -23,13 +23,19 @@ class ::String
|
|
23
23
|
"\\1#{tag_color}\\2#{paren_color}\\3#{value_color}\\4#{paren_color}\\5#{last_color}")
|
24
24
|
end
|
25
25
|
|
26
|
-
def highlight_search(regexes, color: '{y}')
|
26
|
+
def highlight_search(regexes, color: '{y}', last_color: '{xg}')
|
27
27
|
string = dup
|
28
28
|
color = NA::Color.template(color)
|
29
29
|
regexes.each do |rx|
|
30
30
|
next if rx.nil?
|
31
31
|
|
32
|
-
|
32
|
+
rx = Regexp.new(rx.wildcard_to_rx, Regexp::IGNORECASE) if rx.is_a?(String)
|
33
|
+
|
34
|
+
string.gsub!(rx) do
|
35
|
+
m = Regexp.last_match
|
36
|
+
last = m.pre_match.last_color
|
37
|
+
"#{color}#{m[0]}#{NA::Color.template(last)}"
|
38
|
+
end
|
33
39
|
end
|
34
40
|
string
|
35
41
|
end
|
@@ -62,7 +68,7 @@ class ::String
|
|
62
68
|
end
|
63
69
|
|
64
70
|
def wildcard_to_rx
|
65
|
-
gsub(/\./, '\\.').gsub(/\*/, '
|
71
|
+
gsub(/\./, '\\.').gsub(/\*/, '[^ ]*?').gsub(/\?/, '.')
|
66
72
|
end
|
67
73
|
|
68
74
|
def cap_first!
|
data/lib/na/version.rb
CHANGED
data/lib/na.rb
CHANGED
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.
|
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.
|
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
|