na 1.1.7 → 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: 7a47eb8254efd672fd4a240639516c3100244bada4809f40c6eba9fcb6ba4ea7
4
- data.tar.gz: b44d9bbd6d91db44c3929bf64d2a45356297272de4a3ee246cf59921c9579d0c
3
+ metadata.gz: e1c1a61c33eaccbf930903d5adbc75fd4ef717b31bdb21539240535d03b71922
4
+ data.tar.gz: 1c1067564d9e0e8452512cf146ff9443ecc8a61456ed1d1d46dc5a76c5cf2280
5
5
  SHA512:
6
- metadata.gz: f8951228d935af6e614ea068df59060a73c42078f2e63f71242f8a95dfab9225cb86298269a375d684fa3c7617061ef8fb12560fe16429eb80e6e8e7b3a71c25
7
- data.tar.gz: d944ca6cf975bc996b481ae1764b824298440b63baa098d920fc3ac717c7504d9ab988f38965f2e20ce9844b763809dbb546836319cfc19a504c80ef177477c8
6
+ metadata.gz: a39268399afd4fdb653b5578f729967fca4c4313b1c0698e42b714d775257cbdae511380c895066ef7a399dc0637f806cc6890d6664919244cbacbca23a2182b
7
+ data.tar.gz: 7cc6f8938f297e23352d9b5d5bdfa6d3727d316cd6508dc29cf829e8a68939c30964e40036e04624921e157ccbcc45df2e71fd426a06d1e80d59cdcd8b80d98a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
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
+
13
+ ### 1.1.8
14
+
15
+ 2022-10-02 16:40
16
+
17
+ #### FIXED
18
+
19
+ - `na next -t X` didn't replace @na tag in search, but appended to it
20
+
1
21
  ### 1.1.7
2
22
 
3
23
  2022-10-02 12:20
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.1.7)
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.7
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.
@@ -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
@@ -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,11 +90,14 @@ class App
91
90
  end
92
91
  end
93
92
 
94
- tag = options[:tag] == NA.na_tag ? nil : options[:tag]
93
+ NA.na_tag = options[:tag] unless options[:tag].nil?
94
+ require_na = true
95
+
95
96
  tag = [{ tag: tag, value: nil }]
96
97
  files, actions = NA.parse_actions(depth: depth,
97
98
  query: tokens,
98
- tag: tag)
99
+ tag: tag,
100
+ require_na: require_na)
99
101
 
100
102
  NA.output_actions(actions, depth, files: files)
101
103
  end
@@ -119,6 +121,10 @@ class App
119
121
  c.desc 'Add a priority level 1-5'
120
122
  c.flag %i[p priority], must_match: /[1-5]/, type: :integer, default_value: 0
121
123
 
124
+ c.desc 'Add action to specific project'
125
+ c.default_value 'Inbox'
126
+ c.flag %[to]
127
+
122
128
  c.desc 'Use a tag other than the default next action tag'
123
129
  c.arg_name 'TAG'
124
130
  c.flag %i[t tag]
@@ -158,7 +164,7 @@ class App
158
164
  na_tag = " @#{na_tag}"
159
165
  end
160
166
 
161
- action = "#{action.gsub(/#{na_tag}/, '')}#{na_tag}"
167
+ action = "#{action.gsub(/#{na_tag}\b/, '')}#{na_tag}"
162
168
 
163
169
  note = if options[:note]
164
170
  if TTY::Which.exist?('gum')
@@ -168,6 +174,7 @@ class App
168
174
  reader.read_multiline
169
175
  end
170
176
  end
177
+
171
178
  if options[:file]
172
179
  target = File.expand_path(options[:file])
173
180
  unless File.exist?(target)
@@ -200,7 +207,7 @@ class App
200
207
  end
201
208
  end
202
209
 
203
- NA.add_action(target, action, note)
210
+ NA.add_action(target, options[:to], action, note)
204
211
  end
205
212
  end
206
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.7'
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.6<!--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
 
@@ -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][].-->
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.7
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