na 1.1.6 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -1
- data/bin/na +16 -6
- 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 +6 -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: 5b233e64c028a52fe153ef2a02449e90f511a9950c6454d9ed6f198fa79340f0
|
4
|
+
data.tar.gz: 0d2a00e4b387fb2917b22180f34a353038c8eb5a7944fea9570418de10e24c6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab2fe89531b2b4b278375cc35e62922e16101c910d9e95c913202bb1a5879facc00ce868420943cb2fcceb18309a9691bb2b76f8990b7b49f4675d93adb837e6
|
7
|
+
data.tar.gz: 4881155bbc7cb33600462ef01d939847bdca6456fe9c862ef194f9175503246bfc23ecf10983da555d381a113638dd6e6f6b09e17a985f29cdead7c3e082ef38
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
### 1.1.8
|
2
|
+
|
3
|
+
2022-10-02 16:40
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- `na next -t X` didn't replace @na tag in search, but appended to it
|
8
|
+
|
9
|
+
### 1.1.7
|
10
|
+
|
11
|
+
2022-10-02 12:20
|
12
|
+
|
13
|
+
#### IMPROVED
|
14
|
+
|
15
|
+
- You can use !token to add negative values to tag/search queries, e.g. `na tagged +maybe !waiting`
|
16
|
+
|
1
17
|
### 1.1.6
|
2
18
|
|
3
19
|
2022-10-02 11:46
|
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.8
|
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.
|
@@ -22,6 +22,11 @@ It can also auto-display next actions when you enter a project directory, automa
|
|
22
22
|
|
23
23
|
Assuming you have Ruby and RubyGems installed, you can just run `gem install na`. If you run into errors, use `sudo gem install na`.
|
24
24
|
|
25
|
+
If you're using Homebrew, you have the option to install via [brew-gem](https://github.com/sportngin/brew-gem):
|
26
|
+
|
27
|
+
brew install brew-gem
|
28
|
+
brew gem install na
|
29
|
+
|
25
30
|
If you don't have Ruby/RubyGems, you can install them pretty easily with Homebrew, rvm, or asdf. I can't swear this tool is worth the time, but there _are_ a lot of great gems available...
|
26
31
|
|
27
32
|
|
data/bin/na
CHANGED
@@ -91,11 +91,19 @@ class App
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
|
94
|
+
if options[:tag] == NA.na_tag
|
95
|
+
tag = nil
|
96
|
+
require_na = true
|
97
|
+
else
|
98
|
+
tag = options[:tag]
|
99
|
+
require_na = false
|
100
|
+
end
|
101
|
+
|
95
102
|
tag = [{ tag: tag, value: nil }]
|
96
103
|
files, actions = NA.parse_actions(depth: depth,
|
97
104
|
query: tokens,
|
98
|
-
tag: tag
|
105
|
+
tag: tag,
|
106
|
+
require_na: require_na)
|
99
107
|
|
100
108
|
NA.output_actions(actions, depth, files: files)
|
101
109
|
end
|
@@ -233,10 +241,11 @@ class App
|
|
233
241
|
else
|
234
242
|
tokens = []
|
235
243
|
args.each do |arg|
|
236
|
-
m = arg.match(/^(?<req
|
244
|
+
m = arg.match(/^(?<req>[+\-!])?(?<tok>.*?)$/)
|
237
245
|
tokens.push({
|
238
246
|
token: m['tok'],
|
239
|
-
required: !m['req'].nil?
|
247
|
+
required: !m['req'].nil? && m['req'] == '+',
|
248
|
+
negate: !m['req'].nil? && m['req'] =~ /[!\-]/
|
240
249
|
})
|
241
250
|
end
|
242
251
|
end
|
@@ -273,12 +282,13 @@ class App
|
|
273
282
|
tags = []
|
274
283
|
args.each do |arg|
|
275
284
|
# TODO: <> comparisons do nothing right now
|
276
|
-
m = arg.match(/^(?<req
|
285
|
+
m = arg.match(/^(?<req>[+\-!])?(?<tag>[^ =<>]+)(?:(?<op>[=<>]+)(?<val>\S+))?$/)
|
277
286
|
tags.push({
|
278
287
|
tag: m['tag'],
|
279
288
|
comp: m['op'],
|
280
289
|
value: m['val'],
|
281
|
-
required: !m['req'].nil?
|
290
|
+
required: !m['req'].nil? && m['req'] == '+',
|
291
|
+
negate: !m['req'].nil? && m['req'] =~ /[!\-]/
|
282
292
|
})
|
283
293
|
end
|
284
294
|
|
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.7<!--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
|
|
@@ -21,6 +21,11 @@ It can also auto-display next actions when you enter a project directory, automa
|
|
21
21
|
|
22
22
|
Assuming you have Ruby and RubyGems installed, you can just run `gem install na`. If you run into errors, use `sudo gem install na`.
|
23
23
|
|
24
|
+
If you're using Homebrew, you have the option to install via [brew-gem](https://github.com/sportngin/brew-gem):
|
25
|
+
|
26
|
+
brew install brew-gem
|
27
|
+
brew gem install na
|
28
|
+
|
24
29
|
If you don't have Ruby/RubyGems, you can install them pretty easily with Homebrew, rvm, or asdf. I can't swear this tool is worth the time, but there _are_ a lot of great gems available...
|
25
30
|
|
26
31
|
<!--JEKYLL> You can find the na source code (MIT license) on [GitHub][].-->
|