na 1.1.14 → 1.1.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2324b729bcc5e20eab3e063427fa5c6480274ea844fe72117e7f25c7e9801764
4
- data.tar.gz: 68d00ee26f320e14afd0e6a72a072b2cf30c82beaaf7818962b90e7fa0884914
3
+ metadata.gz: d39a0b804774a7d07c6a1154e536798bdc2f09c20e76aa2ca776cc5111c02534
4
+ data.tar.gz: 66e180d9cf673293e2721d83c8187b06746e352252c7fb1575be33032c088b89
5
5
  SHA512:
6
- metadata.gz: b6b7fd0066ba41b9fa184ab3231cb8d7b68e68526bc380f21f2b12048de1c4a4eae24d2da8e47abe95c2389536e90ee32fa35ebdf786570745b8153c72d65e4a
7
- data.tar.gz: 320264ba4f636f8a68804f7767bd09a4c2105adf684b603514d933003f06f72e2cebb978476a659c2a7ee716fbdaadf7f9fd507c3985ec2dc870162da2751414
6
+ metadata.gz: 22e0487072dde7c1bf2f76f412ae20a3018fd038300bdb2aac2557ac77ed1909006c4457debbe31c0c32db57439dff2ec7b07a23f8ebda96ad00748a575a8595
7
+ data.tar.gz: 0e8175309ff9e1d43be62ec03cdd525e34b38c9ba9608e5edbfe90b97b315a43c397e7a318a624ba3f2fa210acc3f30bbadb47590de8a851fac4b092b133a327
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.1.15
2
+
3
+ 2022-10-06 16:12
4
+
5
+ #### CHANGED
6
+
7
+ - If no + or ! tokens are given in search, default to AND search for tokens
8
+
9
+ #### IMPROVED
10
+
11
+ - Better handling of color in search highlighting
12
+
13
+ #### FIXED
14
+
15
+ - --regex search broken
16
+
1
17
  ### 1.1.14
2
18
 
3
19
  2022-10-06 12:30
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.1.14)
4
+ na (1.1.15)
5
5
  gli (~> 2.21.0)
6
6
  tty-reader (~> 0.9, >= 0.9.0)
7
7
  tty-screen (~> 0.8, >= 0.8.1)
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.14
12
+ The current version of `na` is 1.1.15
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
@@ -269,11 +269,13 @@ class App
269
269
  tokens = Regexp.new(args.join(' '), Regexp::IGNORECASE)
270
270
  else
271
271
  tokens = []
272
+ all_req = args.join(' ') !~ /[+!\-]/
273
+
272
274
  args.join(' ').split(/ /).each do |arg|
273
275
  m = arg.match(/^(?<req>[+\-!])?(?<tok>.*?)$/)
274
276
  tokens.push({
275
277
  token: m['tok'],
276
- required: !m['req'].nil? && m['req'] == '+',
278
+ required: all_req || (!m['req'].nil? && m['req'] == '+'),
277
279
  negate: !m['req'].nil? && m['req'] =~ /[!\-]/
278
280
  })
279
281
  end
@@ -285,7 +287,12 @@ class App
285
287
  regex: options[:regex],
286
288
  project: options[:project],
287
289
  require_na: false)
288
- regexes = tokens.delete_if { |token| token[:negate] }.map { |token| token[:token] }
290
+ if tokens.is_a?(Array)
291
+ regexes = tokens.delete_if { |token| token[:negate] }.map { |token| token[:token] }
292
+ else
293
+ regexes = [tokens]
294
+ end
295
+
289
296
  NA.output_actions(actions, depth, files: files, regexes: regexes)
290
297
  end
291
298
  end
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: '{g}')
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
- string.gsub!(/(#{rx.wildcard_to_rx})/i, "#{color}\\1#{NA::Color.template('{xg}')}")
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(/\*/, '.*?').gsub(/\?/, '.')
71
+ gsub(/\./, '\\.').gsub(/\*/, '[^ ]*?').gsub(/\?/, '.')
66
72
  end
67
73
 
68
74
  def cap_first!
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.1.14'
2
+ VERSION = '1.1.15'
3
3
  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.13<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.1.14<!--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.14
4
+ version: 1.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra