na 1.2.57 → 1.2.59

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: c03dd74aa5ba19d5a9c43177cdded736a7e679634ae0adedded1875a88c838e6
4
- data.tar.gz: 46c70464363e14637bc72324c6731b971b97b03a385a07bd16aeb7b005eaebe9
3
+ metadata.gz: 271fbdd631a1b52f0f642ceb291de5b1827282b568d0b510d4cf3ab745660327
4
+ data.tar.gz: 730d5d92191a55c352282429f16215a0a2aab0087bb7072278034d44340ac0ac
5
5
  SHA512:
6
- metadata.gz: ea8ad6bc44298b305cce2c77d8d6ca787bf3240f69f5494e9a580cef4d803c0b6aaa5205e75187901aba73358440192ed56ba2ff55e024a98914a02221b987ce
7
- data.tar.gz: 8b842f443cec04f487700a8f2a31914df683c558dbb1ebcf8196d2987a8f5bb23344c60a26cbbfcac4caed8ed617a50d77634bbe80bf54d6628f7ff2e07c9987
6
+ metadata.gz: 9b67d5f684b95260f3df6b991b9ad86004ab0a55a088f71aaf7028ac41671538109315dbc8e96188cc4ab3efd37472d1da1d3bf2c1f51cd2af3757bf687f5463
7
+ data.tar.gz: 8c3af84aac1bcc1355dcc0eb116146c28cbb2da00d6d636516a58d533bb71aff02960034fcdad9773989e746a01d7e64e0865bf20f3896092ecb4edf7a1475df
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ ### 1.2.59
2
+
3
+ 2023-10-03 07:43
4
+
5
+ #### IMPROVED
6
+
7
+ - Ignore all YAML headers, even with empty values (which can be mistaked for a project)
8
+
9
+ #### FIXED
10
+
11
+ - Inserting new project after first project or inside of existing project
12
+
13
+ ### 1.2.58
14
+
15
+ 2023-09-12 14:11
16
+
17
+ #### NEW
18
+
19
+ - `na next --all` to display next actions from all known todo files (any directory)
20
+
21
+ #### IMPROVED
22
+
23
+ - Middle truncate directory names longer than 1/3 of the screen width
24
+
1
25
  ### 1.2.57
2
26
 
3
27
  2023-09-11 16:43
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.57)
4
+ na (1.2.59)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  gli (~> 2.21.0)
7
7
  mdless (~> 1.0, >= 1.0.32)
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.2.57
12
+ The current version of `na` is 1.2.59
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.
@@ -77,7 +77,7 @@ SYNOPSIS
77
77
  na [global options] command [command options] [arguments...]
78
78
 
79
79
  VERSION
80
- 1.2.57
80
+ 1.2.59
81
81
 
82
82
  GLOBAL OPTIONS
83
83
  -a, --add - Add a next action (deprecated, for backwards compatibility)
@@ -284,6 +284,7 @@ DESCRIPTION
284
284
  Next actions are actions which contain the next action tag (default @na), do not contain @done, and are not in the Archive project. Arguments will target a todo file from history, whether it's in the current directory or not. Todo file queries can include path components separated by / or :, and may use wildcards (`*` to match any text, `?` to match a single character). Multiple queries allowed (separate arguments or separated by comma).
285
285
 
286
286
  COMMAND OPTIONS
287
+ --all - Show next actions from all known todo files (in any directory)
287
288
  -d, --depth=DEPTH - Recurse to depth (default: none)
288
289
  --[no-]done - Include @done actions
289
290
  --exact - Search query is exact text match (not tokens)
@@ -397,6 +398,7 @@ DESCRIPTION
397
398
  Next actions are actions which contain the next action tag (default @na), do not contain @done, and are not in the Archive project. Arguments will target a todo file from history, whether it's in the current directory or not. Todo file queries can include path components separated by / or :, and may use wildcards (`*` to match any text, `?` to match a single character). Multiple queries allowed (separate arguments or separated by comma).
398
399
 
399
400
  COMMAND OPTIONS
401
+ --all - Show next actions from all known todo files (in any directory)
400
402
  -d, --depth=DEPTH - Recurse to depth (default: none)
401
403
  --[no-]done - Include @done actions
402
404
  --exact - Search query is exact text match (not tokens)
data/bin/commands/next.rb CHANGED
@@ -19,6 +19,9 @@ class App
19
19
  c.arg_name 'DEPTH'
20
20
  c.flag %i[d depth], type: :integer, must_match: /^[1-9]$/
21
21
 
22
+ c.desc 'Show next actions from all known todo files (in any directory)'
23
+ c.switch %i[all], negatable: false, default_value: false
24
+
22
25
  c.desc 'Display matches from a known todo file'
23
26
  c.arg_name 'TODO_FILE'
24
27
  c.flag %i[in todo], multiple: true
@@ -121,6 +124,7 @@ class App
121
124
  end
122
125
 
123
126
  args.concat(options[:in])
127
+ args << '*' if options[:all]
124
128
  if args.count.positive?
125
129
  all_req = args.join(' ') !~ /(?<=[, ])[+!-]/
126
130
 
@@ -137,9 +141,7 @@ class App
137
141
  end
138
142
  end
139
143
 
140
- search_for_done = false
141
- tags.each { |tag| search_for_done = true if tag[:tag] =~ /done/ }
142
- options[:done] = true if search_for_done
144
+ options[:done] = true if tags.any? { |tag| tag[:tag] =~ /done/ }
143
145
 
144
146
  search_tokens = nil
145
147
  if options[:exact]
@@ -203,7 +203,7 @@ module NA
203
203
  content = content.split(/\n/).insert(line, input.join("\n")).join("\n")
204
204
  else
205
205
  split = content.split(/\n/)
206
- line = todo.projects.first&.last_line || 0
206
+ line = todo.projects.first&.line || 0
207
207
  before = split.slice(0, line).join("\n")
208
208
  after = split.slice(line, split.count - 0).join("\n")
209
209
  content = "#{before}\n#{input.join("\n")}\n#{after}"
@@ -654,7 +654,6 @@ module NA
654
654
  File.open(db, 'w') { |f| f.puts }
655
655
  []
656
656
  end
657
-
658
657
  end
659
658
 
660
659
  def move_deprecated_backups
data/lib/na/string.rb CHANGED
@@ -90,7 +90,7 @@ class ::String
90
90
  ## @return Colorized string
91
91
  ##
92
92
  def highlight_filename
93
- dir = File.dirname(self).shorten_path
93
+ dir = File.dirname(self).shorten_path.trunc_middle(TTY::Screen.columns / 3)
94
94
  file = NA.include_ext ? File.basename(self) : File.basename(self, ".#{NA.extension}")
95
95
  "#{NA.theme[:dirname]}#{dir}/#{NA.theme[:filename]}#{file}{x}"
96
96
  end
@@ -148,6 +148,16 @@ class ::String
148
148
  string
149
149
  end
150
150
 
151
+ def trunc_middle(max)
152
+ return self unless length > max
153
+
154
+ half = (max / 2).floor - 3
155
+ chars = split('')
156
+ pre = chars.slice(0, half)
157
+ post = chars.reverse.slice(0, half).reverse
158
+ "#{pre.join('')}[...]#{post.join('')}"
159
+ end
160
+
151
161
  def wrap(width, indent)
152
162
  return "\n#{self}" if width <= 80
153
163
 
data/lib/na/todo.rb CHANGED
@@ -99,9 +99,14 @@ module NA
99
99
  content = file.read_file
100
100
  indent_level = 0
101
101
  parent = []
102
+ in_yaml = false
102
103
  in_action = false
103
104
  content.split(/\n/).each.with_index do |line, idx|
104
- if line.project?
105
+ if in_yaml && line !~ /^(---|~~~)\s*$/
106
+ NA.notify("YAML: #{line}", debug: true)
107
+ elsif line =~ /^(---|~~~)\s*$/
108
+ in_yaml = !in_yaml
109
+ elsif line.project? && !in_yaml
105
110
  in_action = false
106
111
  proj = line.project
107
112
  indent = line.indent_level
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.57'
2
+ VERSION = '1.2.59'
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.2.56<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.58<!--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
 
data/test.md ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ comment: 2023-09-03
3
+ keywords:
4
+ ---
5
+ Other New Project:
6
+ - testing @na
7
+ Brand New Project:
8
+ - testing @na
9
+ - testing @na
10
+ Project0:
11
+ - Test1
12
+ - Test2
13
+ Project1:
14
+ - Test4
15
+ - Test5
16
+ - Test6
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.2.57
4
+ version: 1.2.59
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-11 00:00:00.000000000 Z
11
+ date: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -247,6 +247,7 @@ files:
247
247
  - na.rdoc
248
248
  - scripts/fixreadme.rb
249
249
  - src/_README.md
250
+ - test.md
250
251
  - test2.txt
251
252
  homepage: https://brettterpstra.com/projects/na/
252
253
  licenses: