na 1.1.8 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b233e64c028a52fe153ef2a02449e90f511a9950c6454d9ed6f198fa79340f0
4
- data.tar.gz: 0d2a00e4b387fb2917b22180f34a353038c8eb5a7944fea9570418de10e24c6b
3
+ metadata.gz: 7d9dd176974a6c4c20be90d5051c7608469ea7b105537a7859697e3be4050ea5
4
+ data.tar.gz: b201fecc68568c3b80c6626eb425929d2f50faf6a1bd5fe5bae076021ea0d8b1
5
5
  SHA512:
6
- metadata.gz: ab2fe89531b2b4b278375cc35e62922e16101c910d9e95c913202bb1a5879facc00ce868420943cb2fcceb18309a9691bb2b76f8990b7b49f4675d93adb837e6
7
- data.tar.gz: 4881155bbc7cb33600462ef01d939847bdca6456fe9c862ef194f9175503246bfc23ecf10983da555d381a113638dd6e6f6b09e17a985f29cdead7c3e082ef38
6
+ metadata.gz: 169372ba631178c20af2af22e461ba0a6c9fcb7e7e5421d71464b1f180ad766bcd2888d30305354554e24ab86c366c12ffdbab9cc2e0f6c7c03f48f402a32679
7
+ data.tar.gz: c6ea88026936d1f0fe6d9c822945bd7f9ecf351a67871d5fbe27673a2142ef03502fb1759d20d817b4ab8f435942cf6bbdfa24829e535c9684fe507549ac5bee
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 1.1.10
2
+
3
+ 2022-10-05 08:19
4
+
5
+ #### FIXED
6
+
7
+ - When adding a project, don't use Ruby #capitalize, which downcases the rest of the project name
8
+
9
+ ### 1.1.9
10
+
11
+ 2022-10-03 12:08
12
+
13
+ #### NEW
14
+
15
+ - `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.
16
+
17
+ #### FIXED
18
+
19
+ - `-t ALT_TAG` functionality fixed
20
+
1
21
  ### 1.1.8
2
22
 
3
23
  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.10)
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.10
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.
@@ -37,7 +37,7 @@ You can list next actions in files in the current directory by typing `na`. By d
37
37
 
38
38
  #### Easy matching
39
39
 
40
- `na` features intelligent project matching. Every time it locates a todo file, it adds the project to the database. Once a project is recorded, you can list its actions by using any portion of the parent directories or file names. If your project is in `~/Sites/dev/markedapp`, you could quickly list its next actions by typing `na dev mark`. It will always look for the shortest match.
40
+ `na` features intelligent project matching. Every time it locates a todo file, it adds the project to the database. Once a project is recorded, you can list its actions by using any portion of the parent directories or file names. If your project is in `~/Sites/dev/markedapp`, you could quickly list its next actions by typing `na next dev mark`. It will always look for the shortest match.
41
41
 
42
42
  #### Recursion
43
43
 
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.cap_first}:\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.cap_first}:#{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/string.rb CHANGED
@@ -48,4 +48,15 @@ class ::String
48
48
  end
49
49
  true
50
50
  end
51
+
52
+ def cap_first!
53
+ replace cap_first
54
+ end
55
+
56
+ def cap_first
57
+ sub(/^([a-z])(.*)$/) do
58
+ m = Regexp.last_match
59
+ m[1].upcase << m[2]
60
+ end
61
+ end
51
62
  end
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.1.8'
2
+ VERSION = '1.1.10'
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.9<!--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
 
@@ -36,7 +36,7 @@ You can list next actions in files in the current directory by typing `na`. By d
36
36
 
37
37
  #### Easy matching
38
38
 
39
- `na` features intelligent project matching. Every time it locates a todo file, it adds the project to the database. Once a project is recorded, you can list its actions by using any portion of the parent directories or file names. If your project is in `~/Sites/dev/markedapp`, you could quickly list its next actions by typing `na dev mark`. It will always look for the shortest match.
39
+ `na` features intelligent project matching. Every time it locates a todo file, it adds the project to the database. Once a project is recorded, you can list its actions by using any portion of the parent directories or file names. If your project is in `~/Sites/dev/markedapp`, you could quickly list its next actions by typing `na next dev mark`. It will always look for the shortest match.
40
40
 
41
41
  #### Recursion
42
42
 
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.10
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-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake