na 1.2.64 → 1.2.66

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: c2accac212d5f998f830299693f13e3ec27e692b1bc5f460bcd977fb1ce95042
4
- data.tar.gz: ad75051381180b3d4cc99fe3edb841a591e76ca649eaa051a12752f6066a1ed2
3
+ metadata.gz: e55a544aa2a32d81e208e30dc4e3c43cda1e6f91df7b27ee956a72fda328a575
4
+ data.tar.gz: 54f9bba1d550e62b6e2d509f2a3b69263b10049cea0f69b39cd304b6328ec7f7
5
5
  SHA512:
6
- metadata.gz: 96a9f0120855bf9569dd5d35f7701c24196185fa0d82a12e143486687072778cca636369264c45b286e0e4030722cb817258f585f399e50929b3f500bdea47f9
7
- data.tar.gz: bd58a4c3872fb7ad608f15bdc31fd954f8f7581f168c30e7db3c1e11986df884905a964cfcd263d7807a3f583e22d22e33e0f8c9a46842407a5096d5f17b2271
6
+ metadata.gz: cfb11dacafe1d09ec339eb10b419c540fb42f45c0d4bf2492ddc23fabd7df4a7174268e4b9d054fa7b9c5c1e08bb22c6834b32b583ac874a8e2b28261bf7437e
7
+ data.tar.gz: 567acf2c48eb5e84ca4af54fe03aab6d6b4a1b6f74f446d0a723ce9e6ce2bf4f04c8ffa9e41ffbeba5f7e2ba23785a742db2c2dca656b783f40113fad9a03c74
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
+ ### 1.2.66
2
+
3
+ 2024-06-23 10:56
4
+
5
+ #### IMPROVED
6
+
7
+ - When passing a query to `next`, prefer exact matches when available
8
+
1
9
  ### 1.2.64
2
10
 
3
- 2024-06-20 12:25
11
+ 2024-06-22 12:06
12
+
13
+ #### FIXED
14
+
15
+ - Handle file searches where the filename matches the dirname and previously returned a "FILE is a directory" error by testing with an extension or a DIRNAME/BASENAME/BASENAME.EXT
4
16
 
5
17
  #### NEW
6
18
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.64)
4
+ na (1.2.66)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  gli (~> 2.21.0)
7
7
  mdless (~> 1.0, >= 1.0.32)
@@ -23,7 +23,7 @@ GEM
23
23
  tty-cursor (~> 0.7)
24
24
  tty-screen (~> 0.8)
25
25
  wisper (~> 2.0)
26
- tty-screen (0.8.1)
26
+ tty-screen (0.8.2)
27
27
  tty-which (0.5.0)
28
28
  wisper (2.0.1)
29
29
  yard (0.9.34)
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.64.
12
+ The current version of `na` is 1.2.66.
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
 
@@ -76,14 +76,14 @@ SYNOPSIS
76
76
  na [global options] command [command options] [arguments...]
77
77
 
78
78
  VERSION
79
- 1.2.64
79
+ 1.2.66
80
80
 
81
81
  GLOBAL OPTIONS
82
82
  -a, --add - Add a next action (deprecated, for backwards compatibility)
83
83
  --add_at=POSITION - Add all new/moved entries at [s]tart or [e]nd of target project (default: start)
84
84
  --[no-]color - Colorize output (default: enabled)
85
85
  --cwd_as=TYPE - Use current working directory as [p]roject, [t]ag, or [n]one (default: none)
86
- -d, --depth=DEPTH - Recurse to depth (default: 1)
86
+ -d, --depth=DEPTH - Recurse to depth (default: 3)
87
87
  --[no-]debug - Display verbose output
88
88
  --ext=EXT - File extension to consider a todo file (default: taskpaper)
89
89
  -f, --file=PATH - Use a single file as global todo, use initconfig to make permanent (default: none)
data/Rakefile CHANGED
@@ -28,6 +28,23 @@ Rake::TestTask.new do |t|
28
28
  t.test_files = FileList['test/*_test.rb']
29
29
  end
30
30
 
31
+ desc 'Install current gem in all versions of asdf-controlled ruby'
32
+ task :install do
33
+ Rake::Task['clobber'].invoke
34
+ Rake::Task['package'].invoke
35
+ Dir.chdir 'pkg'
36
+ file = Dir.glob('*.gem').last
37
+
38
+ current_ruby = `asdf current ruby`.match(/(\d.\d+.\d+)/)[1]
39
+
40
+ `asdf list ruby`.split.map { |ruby| ruby.strip.sub(/^*/, '') }.each do |ruby|
41
+ `asdf shell ruby #{ruby}`
42
+ puts `gem install #{file}`
43
+ end
44
+
45
+ `asdf shell ruby #{current_ruby}`
46
+ end
47
+
31
48
  desc 'Development version check'
32
49
  task :ver do
33
50
  gver = `git ver`
@@ -513,6 +513,7 @@ module NA
513
513
  }
514
514
  opts = defaults.merge(options)
515
515
  files = find_files(depth: options[:depth])
516
+
516
517
  files.delete_if do |file|
517
518
  cmd_options = {
518
519
  depth: options[:depth],
@@ -577,6 +578,9 @@ module NA
577
578
  end
578
579
 
579
580
  dirs = dirs.sort_by { |d| File.basename(d) }.uniq
581
+
582
+ dirs = find_exact_dir(dirs, search)
583
+
580
584
  if dirs.empty? && require_last
581
585
  NA.notify("#{NA.theme[:warning]}No matches, loosening search", debug: true)
582
586
  match_working_dir(search, distance: 2, require_last: false)
@@ -586,6 +590,18 @@ module NA
586
590
  end
587
591
  end
588
592
 
593
+ def find_exact_dir(dirs, search)
594
+ terms = search.filter { |s| !s[:negate] }.map { |t| t[:token] }.join(' ')
595
+ out = dirs
596
+ dirs.each do |dir|
597
+ if File.basename(dir).sub(/\.#{NA.extension}$/, '') =~ /^#{terms}$/
598
+ out = [dir]
599
+ break
600
+ end
601
+ end
602
+ out
603
+ end
604
+
589
605
  ##
590
606
  ## Save a todo file path to the database
591
607
  ##
data/lib/na/string.rb CHANGED
@@ -39,7 +39,15 @@ class ::String
39
39
  file = File.expand_path(self)
40
40
  raise "Missing file #{file}" unless File.exist?(file)
41
41
 
42
- NA.notify("#{NA.theme[:error]}#{file} is a directory", exit_code: 2) if File.directory?(file)
42
+ if File.directory?(file)
43
+ if File.exist?("#{file}.#{NA.extension}")
44
+ file = "#{file}.#{NA.extension}"
45
+ elsif File.exist?("#{file}/#{File.basename(file)}.#{NA.extension}")
46
+ file = "#{file}/#{File.basename(file)}.#{NA.extension}"
47
+ else
48
+ NA.notify("#{NA.theme[:error]}#{file} is a directory", exit_code: 2)
49
+ end
50
+ end
43
51
 
44
52
  # IO.read(file).force_encoding('ASCII-8BIT').encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
45
53
  IO.read(file).force_encoding('utf-8')
data/lib/na/todo.rb CHANGED
@@ -94,7 +94,7 @@ module NA
94
94
  else
95
95
  NA.match_working_dir(settings[:query])
96
96
  end
97
- NA.notify("Files: #{files.join(', ')}", debug:true)
97
+ NA.notify("Files: #{files.join(', ')}", debug: true)
98
98
  files.each do |file|
99
99
  NA.save_working_dir(File.expand_path(file))
100
100
  content = file.read_file
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.64'
2
+ VERSION = '1.2.66'
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.63<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.65<!--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.2.64
4
+ version: 1.2.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-20 00:00:00.000000000 Z
11
+ date: 2024-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -276,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
276
  - !ruby/object:Gem::Version
277
277
  version: '0'
278
278
  requirements: []
279
- rubygems_version: 3.2.15
279
+ rubygems_version: 3.5.11
280
280
  signing_key:
281
281
  specification_version: 4
282
282
  summary: A command line tool for adding and listing project todos