na 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/Gemfile.lock +2 -1
  4. data/README.md +82 -27
  5. data/bin/na +24 -5
  6. data/lib/na/version.rb +1 -1
  7. data/lib/na.rb +1 -0
  8. data/na.gemspec +9 -3
  9. data/na.rdoc +6 -2
  10. data/scripts/fixreadme.rb +18 -0
  11. data/src/README.md +276 -0
  12. metadata +32 -56
  13. data/html/App.html +0 -105
  14. data/html/NA/Action.html +0 -299
  15. data/html/NA/Color.html +0 -373
  16. data/html/NA.html +0 -100
  17. data/html/README_rdoc.html +0 -328
  18. data/html/String.html +0 -368
  19. data/html/created.rid +0 -9
  20. data/html/css/fonts.css +0 -167
  21. data/html/css/rdoc.css +0 -639
  22. data/html/fonts/Lato-Light.ttf +0 -0
  23. data/html/fonts/Lato-LightItalic.ttf +0 -0
  24. data/html/fonts/Lato-Regular.ttf +0 -0
  25. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  26. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  27. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  28. data/html/images/add.png +0 -0
  29. data/html/images/arrow_up.png +0 -0
  30. data/html/images/brick.png +0 -0
  31. data/html/images/brick_link.png +0 -0
  32. data/html/images/bug.png +0 -0
  33. data/html/images/bullet_black.png +0 -0
  34. data/html/images/bullet_toggle_minus.png +0 -0
  35. data/html/images/bullet_toggle_plus.png +0 -0
  36. data/html/images/date.png +0 -0
  37. data/html/images/delete.png +0 -0
  38. data/html/images/find.png +0 -0
  39. data/html/images/loadingAnimation.gif +0 -0
  40. data/html/images/macFFBgHack.png +0 -0
  41. data/html/images/package.png +0 -0
  42. data/html/images/page_green.png +0 -0
  43. data/html/images/page_white_text.png +0 -0
  44. data/html/images/page_white_width.png +0 -0
  45. data/html/images/plugin.png +0 -0
  46. data/html/images/ruby.png +0 -0
  47. data/html/images/tag_blue.png +0 -0
  48. data/html/images/tag_green.png +0 -0
  49. data/html/images/transparent.png +0 -0
  50. data/html/images/wrench.png +0 -0
  51. data/html/images/wrench_orange.png +0 -0
  52. data/html/images/zoom.png +0 -0
  53. data/html/index.html +0 -297
  54. data/html/js/darkfish.js +0 -84
  55. data/html/js/navigation.js +0 -105
  56. data/html/js/navigation.js.gz +0 -0
  57. data/html/js/search.js +0 -110
  58. data/html/js/search_index.js +0 -1
  59. data/html/js/search_index.js.gz +0 -0
  60. data/html/js/searcher.js +0 -229
  61. data/html/js/searcher.js.gz +0 -0
  62. data/html/table_of_contents.html +0 -252
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4841ea0f17ec2751c09ae7277fa773dd0730a9055eaae68389f4651b606f5fc6
4
- data.tar.gz: 3d056faf540401934754cac051bd29f75c8c851607731d5f16bd937baa8e0968
3
+ metadata.gz: 17064787b8afa01f88d01971b93f9f28593f40666ff8c2d49ecd52dff678654c
4
+ data.tar.gz: f14105b3e652e320b91022a6d4fb6c8cafc0811e6bbc5f7a0888b915e1ba1f99
5
5
  SHA512:
6
- metadata.gz: 612464ec3687922763b9469a65f32b6773dfdc1a98f965f8c3b2f16ba3709c7972fe4771f6c68e5bff3506d329e9e39c4fe1f3bb2257aa2b09dbe06f0389cb85
7
- data.tar.gz: 4e770547abaa252ef7f5b4a691476b1f6c48eb8d9d6304bbf408c12d741ea606d70f7d5331dc8943f445a25622127358fbd96fd03c12bfbaec0384ba4e841943
6
+ metadata.gz: e01fa0fc9027be241d59414d555661df5f1794db2b30fa969562f7db08f22ae1abcd4289f69178a839cb18f4077213b3ae4ee106a776325016633af9f4c6cf12
7
+ data.tar.gz: a13918d2f66aba2b5d84622e33bb60d9404c0795b5ad6c0badcee1ea3e6fe523168d8bdcb46bc45b2fb15df7a62cc54e5f630c9f7c01929982b09fc25b60da79
data/CHANGELOG.md CHANGED
@@ -1,7 +1,28 @@
1
+ ### 1.0.2
2
+
3
+ 2022-09-27 14:18
4
+
5
+ #### IMPROVED
6
+
7
+ - When using gum input, make the input field the width of the terminal
8
+
9
+ #### FIXED
10
+
11
+ - -a with no arguments will work for backward compatability
12
+
13
+ ### 1.0.1
14
+
15
+ 2022-09-27 12:52
16
+
17
+ #### NEW
18
+
19
+ - Add arguments to `na next` to query previously-seen na files in other directories
20
+
1
21
  ### 1.0.0
2
22
 
3
23
  2022-09-27 10:45
4
24
 
5
25
  #### IMPROVED
6
26
 
27
+ - Initial rewrite from Bash script to Ruby gem
7
28
  - Backwards compatibility with the Bash version of NA
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.0.1)
4
+ na (1.0.2)
5
5
  gli (~> 2.21.0)
6
6
  tty-reader (~> 0.9, >= 0.9.0)
7
+ tty-screen (~> 0.8, >= 0.8.1)
7
8
  tty-which (~> 0.5, >= 0.5.0)
8
9
 
9
10
  GEM
data/README.md CHANGED
@@ -1,19 +1,17 @@
1
1
  # na
2
2
 
3
- [![Gem](https://img.shields.io/gem/v/doing.svg)](https://rubygems.org/gems/na)
4
- [![Travis](https://app.travis-ci.com/ttscoff/doing.svg?branch=master)](https://travis-ci.org/makenew/na_gem)
5
- [![GitHub license](https://img.shields.io/github/license/ttscoff/doing.svg)](./LICENSE.txt)
3
+ [![Gem](https://img.shields.io/gem/v/na.svg)](https://rubygems.org/gems/na)
4
+ [![Travis](https://app.travis-ci.com/ttscoff/na_gem.svg?branch=main)](https://travis-ci.org/makenew/na_gem)
5
+ [![GitHub license](https://img.shields.io/github/license/ttscoff/na_gem.svg)](./LICENSE.txt)
6
6
 
7
7
  **A command line tool for adding and listing per-project todos.**
8
8
 
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
- <!--README-->
12
+ The current version of `na` is 1.0.1.
13
13
 
14
- The current version of `na` is <!--VER-->1.0.0<!--END VER-->.
15
-
16
- `na` 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.
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.
17
15
 
18
16
  Used with Taskpaper files, it can add new todo items quickly from the command line, automatically tagging them as next actions.
19
17
 
@@ -39,11 +37,28 @@ If found, it will try to locate an `Inbox:` project, or create one if it doesn't
39
37
 
40
38
  ### Installation
41
39
 
42
- Just run `gem install na`. If you run into errors, use `sudo gem install na`.
40
+ Assuming you have Ruby and RubyGems installed, you can just run `gem install na`. If you run into errors, use `sudo gem install na`.
41
+
42
+ 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...
43
+
44
+
43
45
 
44
46
  ### Usage
45
47
 
46
48
  ```
49
+ NAME
50
+ na - Add and list next actions for the current project
51
+
52
+
53
+ SYNOPSIS
54
+ na [global options] command [command options] [arguments...]
55
+
56
+
57
+ VERSION
58
+ 1.0.2
59
+
60
+
61
+
47
62
  GLOBAL OPTIONS
48
63
  -a, --[no-]add - Add a next action (deprecated, for backwards compatibility)
49
64
  -d, --depth=DEPTH - Recurse to depth (default: 1)
@@ -80,12 +95,22 @@ SYNOPSIS
80
95
 
81
96
  na [global options] add [command options] TASK
82
97
 
98
+ DESCRIPTION
99
+ Provides an easy way to store todos while you work. Add quick reminders and (if you set up Prompt Hooks) they'll automatically display next time you enter the directory. If multiple todo files are found in the current directory, a menu will allow you to pick to which file the action gets added.
83
100
 
84
101
  COMMAND OPTIONS
85
102
  -f, --file=PATH - Specify the file to which the task should be added (default: none)
86
103
  -n, --[no-]note - Prompt for additional notes
87
104
  -p, --priority=arg - Add a priority level 1-5 (default: 0)
88
105
  -t, --tag=TAG - Use a tag other than the default next action tag (default: none)
106
+
107
+ EXAMPLES
108
+
109
+ # Add a new action to the Inbox, including a tag
110
+ na add "A cool feature I thought of @idea"
111
+
112
+ # Add a new action to the Inbox, set its @priority to 4, and prompt for an additional note
113
+ na add "A bug I need to fix" -p 4 -n
89
114
  ```
90
115
 
91
116
  ##### find
@@ -100,17 +125,23 @@ SYNOPSIS
100
125
 
101
126
  na [global options] find [command options] PATTERN
102
127
 
103
-
104
-
105
128
  DESCRIPTION
106
- Search tokens are separated by spaces. Actions matching any token in the pattern will be shown (partial matches allowed). Add a +
107
- before a token to make it required, e.g. `na find +feature +maybe`
108
-
109
-
129
+ Search tokens are separated by spaces. Actions matching any token in the pattern will be shown (partial matches allowed). Add a + before a token to make it required, e.g. `na find +feature +maybe`
110
130
 
111
131
  COMMAND OPTIONS
112
132
  -d, --depth=DEPTH - Recurse to depth (default: 1)
113
133
  -x, --[no-]exact - Match pattern exactly
134
+
135
+ EXAMPLES
136
+
137
+ # Find all actions containing feature, idea, and swift
138
+ na find feature +idea +swift
139
+
140
+ # Find all actions containing the exact text "feature idea"
141
+ na find -x feature idea
142
+
143
+ # Find all actions 3 directories deep containing either swift or obj-c
144
+ na find -d 3 swift obj-c
114
145
  ```
115
146
 
116
147
  ##### next, show
@@ -129,10 +160,17 @@ SYNOPSIS
129
160
 
130
161
  na [global options] next [command options] OPTIONAL_QUERY
131
162
 
132
-
133
163
  COMMAND OPTIONS
134
164
  -d, --depth=DEPTH - Recurse to depth (default: none)
135
165
  -t, --tag=arg - Alternate tag to search for (default: na)
166
+
167
+ EXAMPLES
168
+
169
+ # display the next actions from any todo files in the current directory
170
+ doing next
171
+
172
+ # display the next actions from the current directory and its children, 3 levels deep
173
+ doing next -d 3
136
174
  ```
137
175
 
138
176
  ##### tagged
@@ -147,16 +185,19 @@ SYNOPSIS
147
185
 
148
186
  na [global options] tagged [command options] TAG [VALUE]
149
187
 
150
-
151
-
152
188
  DESCRIPTION
153
- Finds actions with tags matching the arguments. An action is shown if it contains any of the tags listed. Add a + before a tag to
154
- make it required, e.g. `na tagged feature +maybe`
155
-
156
-
189
+ Finds actions with tags matching the arguments. An action is shown if it contains any of the tags listed. Add a + before a tag to make it required, e.g. `na tagged feature +maybe`
157
190
 
158
191
  COMMAND OPTIONS
159
192
  -d, --depth=DEPTH - Recurse to depth (default: 1)
193
+
194
+ EXAMPLES
195
+
196
+ # Show all actions tagged @maybe
197
+ na tagged +maybe
198
+
199
+ # Show all actions tagged either @feature or @idea, recurse 3 levels
200
+ na tagged -d 3 feature idea
160
201
  ```
161
202
 
162
203
  ### Configuration
@@ -165,6 +206,26 @@ Global options such as todo extension and default next action tag can be stored
165
206
 
166
207
  Example: `na --ext md --na_tag next initconfig --force`
167
208
 
209
+ When this command is run, it doesn't include options for subcommands, but inserts placeholders for them. If you want to permanently set an option for a subcommand, you'll need to edit `~/.na.rc`. For example, if you wanted the `next` command to always recurse 2 levels deep, you could edit it to look like this:
210
+
211
+ ```yaml
212
+ ---
213
+ :ext: taskpaper
214
+ :na_tag: na
215
+ :d: 1
216
+ commands:
217
+ :next:
218
+ :depth: 2
219
+ :add: {}
220
+ :find: {}
221
+ :tagged: {}
222
+ ```
223
+
224
+ Note that I created a new YAML dictionary inside of the `:next:` command, and added a `:depth:` key that matches the setting I want to make permanent.
225
+
226
+ > **WARNING** Don't touch most of the settings at the top of the auto-generated file. Setting any of them to true will alter the way na interprets the commands you're running. Most of those options are there for backwards compatibility with the bash version of this tool and will eventually be removed.
227
+
228
+
168
229
  ### Prompt Hooks
169
230
 
170
231
  You can add a prompt command to your shell to have na automatically list your next actions when you `cd` into a directory. Add the appropriate command to your login file for your shell:
@@ -208,10 +269,4 @@ If you have [gum][] installed, na will use it for command line input when adding
208
269
  [donate]: http://brettterpstra.com/donate/
209
270
  [github]: https://github.com/ttscoff/na_gem/
210
271
 
211
- <!--END README-->
212
-
213
272
  PayPal link: [paypal.me/ttscoff](https://paypal.me/ttscoff)
214
-
215
- ## Changelog
216
-
217
- See [CHANGELOG.md](https://github.com/ttscoff/na_gem/blob/master/CHANGELOG.md)
data/bin/na CHANGED
@@ -50,6 +50,9 @@ class App
50
50
  desc 'Show next actions'
51
51
  arg_name 'OPTIONAL_QUERY'
52
52
  command %i[next show] do |c|
53
+ c.example 'doing next', desc: 'display the next actions from any todo files in the current directory'
54
+ c.example 'doing next -d 3', desc: 'display the next actions from the current directory and its children, 3 levels deep'
55
+
53
56
  c.desc 'Recurse to depth'
54
57
  c.arg_name 'DEPTH'
55
58
  c.flag %i[d depth], type: :integer, must_match: /^\d+$/
@@ -63,8 +66,8 @@ class App
63
66
  cmd = ['add']
64
67
  cmd.push('--note') if global_options[:note]
65
68
  cmd.concat(['--priority', global_options[:priority]]) if global_options[:priority]
66
- cmd.push(ARGV.unshift(@command))
67
- p cmd
69
+ cmd.push(ARGV.unshift($first_arg)) if ARGV.count.positive?
70
+
68
71
  exit run(cmd)
69
72
  end
70
73
 
@@ -97,8 +100,17 @@ class App
97
100
  end
98
101
 
99
102
  desc 'Add a new next action'
103
+ long_desc 'Provides an easy way to store todos while you work. Add quick reminders and (if you set up Prompt Hooks)
104
+ they\'ll automatically display next time you enter the directory.
105
+
106
+ If multiple todo files are found in the current directory, a menu will allow you to pick to which
107
+ file the action gets added.'
100
108
  arg_name 'TASK'
101
109
  command :add do |c|
110
+ c.example 'na add "A cool feature I thought of @idea"', desc: 'Add a new action to the Inbox, including a tag'
111
+ c.example 'na add "A bug I need to fix" -p 4 -n',
112
+ desc: 'Add a new action to the Inbox, set its @priority to 4, and prompt for an additional note'
113
+
102
114
  c.desc 'Prompt for additional notes'
103
115
  c.switch %i[n note]
104
116
 
@@ -118,7 +130,7 @@ class App
118
130
  action = if args.count.positive?
119
131
  args.join(' ').strip
120
132
  elsif TTY::Which.exist?('gum')
121
- `gum input --placeholder "Enter a task"`.strip
133
+ `gum input --placeholder "Enter a task" --char-limit=500 --width=#{TTY::Screen.columns}`.strip
122
134
  else
123
135
  puts NA::Color.template('{bm}Enter task:{x}')
124
136
  reader.read_line(NA::Color.template('{by}> {bw}')).strip
@@ -178,7 +190,7 @@ class App
178
190
  end
179
191
  end
180
192
 
181
- save_working_dir(File.expand_path(target))
193
+ NA.save_working_dir(File.expand_path(target))
182
194
  NA.add_action(target, action, note)
183
195
  end
184
196
  end
@@ -188,6 +200,10 @@ class App
188
200
  (partial matches allowed). Add a + before a token to make it required, e.g. `na find +feature +maybe`'
189
201
  arg_name 'PATTERN'
190
202
  command %i[find] do |c|
203
+ c.example 'na find feature +idea +swift', desc: 'Find all actions containing feature, idea, and swift'
204
+ c.example 'na find -x feature idea', desc: 'Find all actions containing the exact text "feature idea"'
205
+ c.example 'na find -d 3 swift obj-c', desc: 'Find all actions 3 directories deep containing either swift or obj-c'
206
+
191
207
  c.desc 'Match pattern exactly'
192
208
  c.switch %i[x exact]
193
209
 
@@ -231,6 +247,9 @@ class App
231
247
  e.g. `na tagged feature +maybe`'
232
248
  arg_name 'TAG [VALUE]'
233
249
  command %i[tagged] do |c|
250
+ c.example 'na tagged +maybe', desc: 'Show all actions tagged @maybe'
251
+ c.example 'na tagged -d 3 feature idea', desc: 'Show all actions tagged either @feature or @idea, recurse 3 levels'
252
+
234
253
  c.desc 'Recurse to depth'
235
254
  c.arg_name 'DEPTH'
236
255
  c.default_value 1
@@ -285,7 +304,7 @@ class App
285
304
  if ARGV.count.positive?
286
305
  cmd.concat(ARGV.unshift($first_arg))
287
306
  end
288
- p cmd
307
+
289
308
  exit run(cmd)
290
309
  when SystemExit
291
310
  false
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
data/lib/na.rb CHANGED
@@ -4,6 +4,7 @@ require 'na/version.rb'
4
4
  # you just need to require this one file in your bin file
5
5
  require 'fileutils'
6
6
  require 'shellwords'
7
+ require 'tty-screen'
7
8
  require 'tty-reader'
8
9
  require 'tty-which'
9
10
  require 'na/colors.rb'
data/na.gemspec CHANGED
@@ -5,16 +5,21 @@ spec = Gem::Specification.new do |s|
5
5
  s.version = Na::VERSION
6
6
  s.author = 'Brett Terpstra'
7
7
  s.email = 'me@brettterpstra.com'
8
- s.homepage = 'https://brettterpstra.com'
8
+ s.homepage = 'https://brettterpstra.com/projects/na/'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.summary = 'A command line tool for adding and listing project todos'
11
+ s.description = [
12
+ 'A tool for managing a TaskPaper file of project todos for the current directory.',
13
+ 'Easily create "next actions" to come back to, add tags and priorities, and notes.',
14
+ 'Add prompt hooks to display your next actions automatically when cd\'ing into a directory.'
15
+ ].join(' ')
11
16
  s.license = 'MIT'
12
17
  s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
13
18
  `git ls-files -z`.split("\x0").reject { |f| f.strip =~ %r{^((test|spec|features)/|\.git|buildnotes|.*\.taskpaper)} }
14
19
  end
15
20
  s.require_paths << 'lib'
16
- s.extra_rdoc_files = ['README.rdoc','na.rdoc']
17
- s.rdoc_options << '--title' << 'na' << '--main' << 'README.rdoc' << '-ri'
21
+ s.extra_rdoc_files = ['README.md','na.rdoc']
22
+ s.rdoc_options << '--title' << 'na' << '--main' << 'README.md' << '--markup' << 'markdown'
18
23
  s.bindir = 'bin'
19
24
  s.executables << 'na'
20
25
  s.add_development_dependency('rake','~> 0.9.2')
@@ -23,5 +28,6 @@ spec = Gem::Specification.new do |s|
23
28
  s.add_development_dependency('yard', '~> 0.9', '>= 0.9.26')
24
29
  s.add_runtime_dependency('gli','~> 2.21.0')
25
30
  s.add_runtime_dependency('tty-reader', '~> 0.9', '>= 0.9.0')
31
+ s.add_runtime_dependency('tty-screen', '~> 0.8', '>= 0.8.1')
26
32
  s.add_runtime_dependency('tty-which', '~> 0.5', '>= 0.5.0')
27
33
  end
data/na.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  == na - Add and list next actions for the current project
2
2
 
3
- v1.0.0
3
+ v1.0.2
4
4
 
5
5
  === Global Options
6
6
  === -d|--depth DEPTH
@@ -61,7 +61,11 @@ Display the program version
61
61
  ==== Command: <tt>add TASK</tt>
62
62
  Add a new next action
63
63
 
64
+ Provides an easy way to store todos while you work. Add quick reminders and (if you set up Prompt Hooks)
65
+ they'll automatically display next time you enter the directory.
64
66
 
67
+ If multiple todo files are found in the current directory, a menu will allow you to pick to which
68
+ file the action gets added.
65
69
  ===== Options
66
70
  ===== -f|--file PATH
67
71
 
@@ -129,7 +133,7 @@ force overwrite of existing config file
129
133
 
130
134
 
131
135
 
132
- ==== Command: <tt>next|show </tt>
136
+ ==== Command: <tt>next|show OPTIONAL_QUERY</tt>
133
137
  Show next actions
134
138
 
135
139
 
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ current_ver = ARGV[0]
5
+ src = 'src/README.md'
6
+ dest = 'README.md'
7
+
8
+ readme = IO.read(src).force_encoding('ASCII-8BIT').encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
9
+
10
+ content = readme.match(/(?<=\<!--README-->)(.*?)(?=\<!--END README-->)/m)[0]
11
+
12
+ content.gsub!(/<!--VER-->(.*?)<!--END VER-->/, current_ver)
13
+ content.gsub!(/<!--GITHUB-->(.*?)<!--END GITHUB-->/m, '\1')
14
+ content.gsub!(/<!--JEKYLL(.*?)-->/m, '')
15
+
16
+ File.open(dest, 'w') { |f| f.puts(content) }
17
+
18
+ Process.exit 0