na 1.1.8 → 1.1.9

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: 5b233e64c028a52fe153ef2a02449e90f511a9950c6454d9ed6f198fa79340f0
4
- data.tar.gz: 0d2a00e4b387fb2917b22180f34a353038c8eb5a7944fea9570418de10e24c6b
3
+ metadata.gz: e1c1a61c33eaccbf930903d5adbc75fd4ef717b31bdb21539240535d03b71922
4
+ data.tar.gz: 1c1067564d9e0e8452512cf146ff9443ecc8a61456ed1d1d46dc5a76c5cf2280
5
5
  SHA512:
6
- metadata.gz: ab2fe89531b2b4b278375cc35e62922e16101c910d9e95c913202bb1a5879facc00ce868420943cb2fcceb18309a9691bb2b76f8990b7b49f4675d93adb837e6
7
- data.tar.gz: 4881155bbc7cb33600462ef01d939847bdca6456fe9c862ef194f9175503246bfc23ecf10983da555d381a113638dd6e6f6b09e17a985f29cdead7c3e082ef38
6
+ metadata.gz: a39268399afd4fdb653b5578f729967fca4c4313b1c0698e42b714d775257cbdae511380c895066ef7a399dc0637f806cc6890d6664919244cbacbca23a2182b
7
+ data.tar.gz: 7cc6f8938f297e23352d9b5d5bdfa6d3727d316cd6508dc29cf829e8a68939c30964e40036e04624921e157ccbcc45df2e71fd426a06d1e80d59cdcd8b80d98a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 1.1.9
2
+
3
+ 2022-10-03 12:08
4
+
5
+ #### NEW
6
+
7
+ - `na add --to PROJECT` option to add an action to a project other than Inbox. Case insensitive but requires exact project match. Missing project will be created at top of file.
8
+
9
+ #### FIXED
10
+
11
+ - `-t ALT_TAG` functionality fixed
12
+
1
13
  ### 1.1.8
2
14
 
3
15
  2022-10-02 16:40
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.1.8)
4
+ na (1.1.9)
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.8
12
+ The current version of `na` is 1.1.9
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
@@ -23,7 +23,7 @@ class App
23
23
  desc 'Tag to consider a next action'
24
24
  default_value 'na'
25
25
  arg_name 'TAG'
26
- flag :na_tag
26
+ flag %i[t na_tag]
27
27
 
28
28
  default_command :next
29
29
 
@@ -61,7 +61,6 @@ class App
61
61
  c.flag %i[d depth], type: :integer, must_match: /^\d+$/
62
62
 
63
63
  c.desc 'Alternate tag to search for'
64
- c.default_value 'na'
65
64
  c.flag %i[t tag]
66
65
 
67
66
  c.action do |global_options, options, args|
@@ -91,13 +90,8 @@ class App
91
90
  end
92
91
  end
93
92
 
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
93
+ NA.na_tag = options[:tag] unless options[:tag].nil?
94
+ require_na = true
101
95
 
102
96
  tag = [{ tag: tag, value: nil }]
103
97
  files, actions = NA.parse_actions(depth: depth,
@@ -127,6 +121,10 @@ class App
127
121
  c.desc 'Add a priority level 1-5'
128
122
  c.flag %i[p priority], must_match: /[1-5]/, type: :integer, default_value: 0
129
123
 
124
+ c.desc 'Add action to specific project'
125
+ c.default_value 'Inbox'
126
+ c.flag %[to]
127
+
130
128
  c.desc 'Use a tag other than the default next action tag'
131
129
  c.arg_name 'TAG'
132
130
  c.flag %i[t tag]
@@ -166,7 +164,7 @@ class App
166
164
  na_tag = " @#{na_tag}"
167
165
  end
168
166
 
169
- action = "#{action.gsub(/#{na_tag}/, '')}#{na_tag}"
167
+ action = "#{action.gsub(/#{na_tag}\b/, '')}#{na_tag}"
170
168
 
171
169
  note = if options[:note]
172
170
  if TTY::Which.exist?('gum')
@@ -176,6 +174,7 @@ class App
176
174
  reader.read_multiline
177
175
  end
178
176
  end
177
+
179
178
  if options[:file]
180
179
  target = File.expand_path(options[:file])
181
180
  unless File.exist?(target)
@@ -208,7 +207,7 @@ class App
208
207
  end
209
208
  end
210
209
 
211
- NA.add_action(target, action, note)
210
+ NA.add_action(target, options[:to], action, note)
212
211
  end
213
212
  end
214
213
 
@@ -57,16 +57,16 @@ module NA
57
57
  end
58
58
  end
59
59
 
60
- def add_action(file, action, note = nil)
60
+ def add_action(file, project, action, note = nil)
61
61
  content = IO.read(file)
62
- unless content =~ /^[ \t]*Inbox:/i
63
- content = "Inbox: @inbox\n#{content}"
62
+ unless content =~ /^[ \t]*#{project}:/i
63
+ content = "#{project.capitalize}:\n#{content}"
64
64
  end
65
65
 
66
- content.sub!(/^([ \t]*)Inbox:(.*?)$/) do
66
+ content.sub!(/^([ \t]*)#{project}:(.*?)$/i) do
67
67
  m = Regexp.last_match
68
68
  note = note.nil? ? '' : "\n#{m[1]}\t\t#{note.join('').strip}"
69
- "#{m[1]}Inbox:#{m[2]}\n#{m[1]}\t- #{action}#{note}"
69
+ "#{m[1]}#{project.capitalize}:#{m[2]}\n#{m[1]}\t- #{action}#{note}"
70
70
  end
71
71
 
72
72
  File.open(file, 'w') { |f| f.puts content }
@@ -105,7 +105,7 @@ module NA
105
105
 
106
106
  tag&.each do |t|
107
107
  unless t[:tag].nil?
108
- new_rx = " @#{t[:tag]}"
108
+ new_rx = " @#{t[:tag]}\\b"
109
109
  new_rx = "#{new_rx}\\(#{t[:value]}\\)" if t[:value]
110
110
 
111
111
  optional.push(new_rx) unless t[:negate]
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.1.8'
2
+ VERSION = '1.1.9'
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.7<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.1.8<!--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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-02 00:00:00.000000000 Z
11
+ date: 2022-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake