na 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/bin/na +6 -4
- data/lib/na/next_action.rb +9 -7
- data/lib/na/string.rb +9 -2
- data/lib/na/version.rb +1 -1
- data/src/README.md +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a47eb8254efd672fd4a240639516c3100244bada4809f40c6eba9fcb6ba4ea7
|
4
|
+
data.tar.gz: b44d9bbd6d91db44c3929bf64d2a45356297272de4a3ee246cf59921c9579d0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8951228d935af6e614ea068df59060a73c42078f2e63f71242f8a95dfab9225cb86298269a375d684fa3c7617061ef8fb12560fe16429eb80e6e8e7b3a71c25
|
7
|
+
data.tar.gz: d944ca6cf975bc996b481ae1764b824298440b63baa098d920fc3ac717c7504d9ab988f38965f2e20ce9844b763809dbb546836319cfc19a504c80ef177477c8
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
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.7
|
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
@@ -233,10 +233,11 @@ class App
|
|
233
233
|
else
|
234
234
|
tokens = []
|
235
235
|
args.each do |arg|
|
236
|
-
m = arg.match(/^(?<req
|
236
|
+
m = arg.match(/^(?<req>[+\-!])?(?<tok>.*?)$/)
|
237
237
|
tokens.push({
|
238
238
|
token: m['tok'],
|
239
|
-
required: !m['req'].nil?
|
239
|
+
required: !m['req'].nil? && m['req'] == '+',
|
240
|
+
negate: !m['req'].nil? && m['req'] =~ /[!\-]/
|
240
241
|
})
|
241
242
|
end
|
242
243
|
end
|
@@ -273,12 +274,13 @@ class App
|
|
273
274
|
tags = []
|
274
275
|
args.each do |arg|
|
275
276
|
# TODO: <> comparisons do nothing right now
|
276
|
-
m = arg.match(/^(?<req
|
277
|
+
m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>]+)(?:(?<op>[=<>]+)(?<val>\S+))?$/)
|
277
278
|
tags.push({
|
278
279
|
tag: m['tag'],
|
279
280
|
comp: m['op'],
|
280
281
|
value: m['val'],
|
281
|
-
required: !m['req'].nil?
|
282
|
+
required: !m['req'].nil? && m['req'] == '+',
|
283
|
+
negate: !m['req'].nil? && m['req'] =~ /[!\-]/
|
282
284
|
})
|
283
285
|
end
|
284
286
|
|
data/lib/na/next_action.rb
CHANGED
@@ -101,14 +101,16 @@ module NA
|
|
101
101
|
actions = []
|
102
102
|
required = []
|
103
103
|
optional = []
|
104
|
+
negated = []
|
104
105
|
|
105
106
|
tag&.each do |t|
|
106
107
|
unless t[:tag].nil?
|
107
108
|
new_rx = " @#{t[:tag]}"
|
108
109
|
new_rx = "#{new_rx}\\(#{t[:value]}\\)" if t[:value]
|
109
110
|
|
110
|
-
optional.push(new_rx)
|
111
|
-
required.push(new_rx) if t[:required]
|
111
|
+
optional.push(new_rx) unless t[:negate]
|
112
|
+
required.push(new_rx) if t[:required] && !t[:negate]
|
113
|
+
negated.push(new_rx) if t[:negate]
|
112
114
|
end
|
113
115
|
end
|
114
116
|
|
@@ -120,8 +122,9 @@ module NA
|
|
120
122
|
search.each do |t|
|
121
123
|
new_rx = t[:token].to_s
|
122
124
|
|
123
|
-
optional.push(new_rx)
|
124
|
-
required.push(new_rx) if t[:required]
|
125
|
+
optional.push(new_rx) unless t[:negate]
|
126
|
+
required.push(new_rx) if t[:required] && !t[:negate]
|
127
|
+
negated.push(new_rx) if t[:negate]
|
125
128
|
end
|
126
129
|
end
|
127
130
|
end
|
@@ -140,7 +143,6 @@ module NA
|
|
140
143
|
indent_level = 0
|
141
144
|
parent = []
|
142
145
|
content.split("\n").each do |line|
|
143
|
-
new_action = nil
|
144
146
|
if line =~ /([ \t]*)([^\-]+.*?): *(@\S+ *)*$/
|
145
147
|
proj = Regexp.last_match(2)
|
146
148
|
indent = line.indent_level
|
@@ -158,8 +160,8 @@ module NA
|
|
158
160
|
elsif line =~ /^[ \t]*- / && line !~ / @done/
|
159
161
|
next if require_na && line !~ /@#{NA.na_tag}\b/
|
160
162
|
|
161
|
-
unless optional.empty? && required.empty?
|
162
|
-
next unless line.matches(any: optional, all: required)
|
163
|
+
unless optional.empty? && required.empty? && negated.empty?
|
164
|
+
next unless line.matches(any: optional, all: required, none: negated)
|
163
165
|
|
164
166
|
end
|
165
167
|
|
data/lib/na/string.rb
CHANGED
@@ -24,8 +24,15 @@ class ::String
|
|
24
24
|
gsub(/(\s|m)(@[^ ("']+)(?:(\()(.*?)(\)))?/, "\\1#{tag_color}\\2#{paren_color}\\3#{value_color}\\4#{paren_color}\\5#{last_color}")
|
25
25
|
end
|
26
26
|
|
27
|
-
def matches(any: [], all: [])
|
28
|
-
matches_any(any) && matches_all(all)
|
27
|
+
def matches(any: [], all: [], none: [])
|
28
|
+
matches_any(any) && matches_all(all) && matches_none(none)
|
29
|
+
end
|
30
|
+
|
31
|
+
def matches_none(regexes)
|
32
|
+
regexes.each do |rx|
|
33
|
+
return false if match(Regexp.new(rx, Regexp::IGNORECASE))
|
34
|
+
end
|
35
|
+
true
|
29
36
|
end
|
30
37
|
|
31
38
|
def matches_any(regexes)
|
data/lib/na/version.rb
CHANGED
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.6<!--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
|
|