intent 0.5.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +10 -28
  5. data/bin/{review → intent} +1 -2
  6. data/bin/inventory +12 -0
  7. data/bin/project_doc +30 -0
  8. data/bin/projects +1 -1
  9. data/bin/projects_active +123 -0
  10. data/bin/todo +1 -1
  11. data/bin/todo_review +123 -0
  12. data/intent.gemspec +15 -7
  13. data/lib/gem_ext/todo-txt.rb +26 -2
  14. data/lib/intent/commands/base.rb +40 -0
  15. data/lib/intent/commands/errors.rb +7 -0
  16. data/lib/intent/commands/intent.rb +9 -0
  17. data/lib/intent/commands/inventory.rb +174 -0
  18. data/lib/intent/commands/projects.rb +34 -0
  19. data/lib/intent/commands/todo.rb +51 -0
  20. data/lib/intent/commands.rb +9 -0
  21. data/lib/intent/core.rb +184 -0
  22. data/lib/intent/desktop.rb +3 -0
  23. data/lib/intent/projects.rb +1 -1
  24. data/lib/intent/review.rb +10 -1
  25. data/lib/intent/text/inventory.help.txt +6 -0
  26. data/lib/intent/text/project.help.txt +7 -0
  27. data/lib/intent/text/projects.help.txt +9 -0
  28. data/lib/intent/text/todo.help.txt +15 -0
  29. data/lib/intent/todo.rb +3 -1
  30. data/lib/intent/ui/ttyui.rb +90 -0
  31. data/lib/intent/verbs/add.rb +21 -0
  32. data/lib/intent/verbs/cite.rb +14 -0
  33. data/lib/intent/verbs/install.rb +20 -0
  34. data/lib/intent/verbs/review.rb +131 -0
  35. data/lib/intent/{todo/manager.rb → verbs/todo.rb} +3 -16
  36. data/lib/intent/version.rb +1 -1
  37. data/lib/intent.rb +20 -3
  38. metadata +179 -32
  39. data/.travis.yml +0 -4
  40. data/CODE_OF_CONDUCT.md +0 -13
  41. data/lib/intent/projects/manager.rb +0 -20
  42. data/lib/intent/review/manager.rb +0 -17
  43. /data/lib/intent/{projects → verbs}/status.rb +0 -0
@@ -0,0 +1,131 @@
1
+ module Intent
2
+ module Review
3
+ class Commands < Intent::CommandDispatcher
4
+ def run(args, output=STDOUT)
5
+ if args.empty?
6
+ launch_densityplot
7
+ else
8
+ print_help(output)
9
+ end
10
+ end
11
+
12
+ def launch_densityplot
13
+ UnicodePlot.barplot(data: {'calyx': 20, 'fictive': 50}, title: "Projects").render
14
+ end
15
+
16
+ def launch_ui_loop
17
+ list = Todo::List.new(ENV['TODO_TXT'])
18
+
19
+ box = TTY::Box.frame(
20
+ width: TTY::Screen.width,
21
+ height: TTY::Screen.height-1,
22
+ align: :center,
23
+ border: :thick,
24
+ style: {
25
+ fg: :bright_yellow,
26
+ border: {
27
+ fg: :white,
28
+ }
29
+ }
30
+ )
31
+
32
+ focus_index = 0
33
+
34
+ def truncate(str, width)
35
+ return str unless str.length >= width
36
+
37
+ "#{str.slice(0, width-3)}..."
38
+ end
39
+
40
+ def draw_card(top, item, focus)
41
+
42
+ style = unless top == focus
43
+ { fg: :white, border: { fg: :white } }
44
+ else
45
+ { fg: :bright_white, border: { fg: :bright_magenta, bg: :black } }
46
+ end
47
+
48
+ title = if top == focus
49
+ {bottom_right: "[x: close][enter: launch]"}
50
+ else
51
+ {}
52
+ end
53
+
54
+ #pastel = Pastel.new
55
+ width = 90
56
+
57
+ TTY::Box.frame(width: width, height: 4, left: 4, title: title, border: :thick, style: style) do
58
+ "\s#{truncate(item[:title], 88)}\n\s#{truncate(item[:href], 88)}"
59
+ end
60
+ end
61
+
62
+ items_per_page = (TTY::Screen.height-1) / 4
63
+
64
+ items = list.by_not_done.by_context("@reading").slice(0, items_per_page).map do |item|
65
+ { title: item.text, href: item.text }
66
+ end
67
+
68
+ $cursor = TTY::Cursor
69
+ print $cursor.hide
70
+
71
+ def draw_list(items, focus)
72
+ buffer = []
73
+ items.each_with_index do |item, i|
74
+ buffer << draw_card(i, item, focus)
75
+ end
76
+ result = buffer.join("")
77
+
78
+ print $cursor.clear_screen + $cursor.move_to(0,0)
79
+ print result
80
+ end
81
+
82
+ draw_list(items, focus_index)
83
+
84
+ reader = TTY::Reader.new(interrupt: :exit)
85
+
86
+ reader.on(:keyctrl_x, :keyescape) do
87
+ print $cursor.clear_screen + $cursor.move_to(0,0)
88
+ print $cursor.show
89
+ exit
90
+ end
91
+
92
+ reader.on(:keytab, :keydown) do
93
+ if focus_index == items.count - 1
94
+ focus_index = 0
95
+ else
96
+ focus_index += 1
97
+ end
98
+ draw_list(items, focus_index)
99
+ end
100
+
101
+ reader.on(:keyup) do
102
+ if focus_index == 0
103
+ focus_index = items.count - 1
104
+ else
105
+ focus_index -= 1
106
+ end
107
+ draw_list(items, focus_index)
108
+ end
109
+
110
+ reader.on(:keypress) do |key|
111
+ if key.value == "x"
112
+ items.delete_at(focus_index)
113
+ focus_index -= 1 if focus_index >= items.count
114
+ draw_list(items, focus_index)
115
+ end
116
+ end
117
+
118
+ reader.on(:keyenter) do
119
+ `chrome-cli open #{items[focus_index][:href]}`
120
+ end
121
+
122
+ loop do
123
+ reader.read_line(echo: false)
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
129
+
130
+
131
+
@@ -4,10 +4,10 @@ module Intent
4
4
  List = ::Todo::List
5
5
  Syntax = ::Todo::Syntax
6
6
 
7
- class Manager
7
+ class Commands < Intent::CommandDispatcher
8
8
  include Syntax
9
9
 
10
- def self.run(args, output=STDOUT)
10
+ def run(args, output=STDOUT)
11
11
  if args.empty?
12
12
  print_help(output)
13
13
  else
@@ -183,20 +183,7 @@ module Intent
183
183
  end
184
184
 
185
185
  def self.print_help(output)
186
- output.puts "usage: todo"
187
- output.puts
188
- output.puts "A set of tasks for managing a plain text todo list."
189
- output.puts
190
- output.puts "todo list - list all items in the list"
191
- output.puts "todo add - add a new task to the list"
192
- output.puts "todo sample - randomly select a priority task"
193
- output.puts "todo projects - list all project tags in the list"
194
- output.puts "todo contexts - list all context tags in the list"
195
- output.puts "todo archive - archive completed tasks in the nearest `done.txt`"
196
- output.puts "todo status - show completion status for all projects"
197
- output.puts "todo sync - synchronize local changes with remote git repo"
198
- output.puts "todo collect - collect open browser tabs as items for later reading"
199
- output.puts "todo focus - block distractions and start focusing"
186
+ output.puts File.read('./todo.help.txt')
200
187
  end
201
188
  end
202
189
  end
@@ -1,3 +1,3 @@
1
1
  module Intent
2
- VERSION = '0.5.5'
2
+ VERSION = '0.7.0'
3
3
  end
data/lib/intent.rb CHANGED
@@ -1,4 +1,21 @@
1
- require 'intent/todo'
2
- require 'intent/review'
3
- require 'intent/projects'
1
+ #require 'random'
2
+ require 'todo-txt'
3
+ require 'pastel'
4
+ require 'tty-prompt'
5
+ require 'tty-table'
6
+ require 'tty-tree'
7
+ require 'nanoid'
8
+ require 'gem_ext/todo-txt'
9
+
10
+ Todo.customize do |options|
11
+ options.require_completed_on = false
12
+ end
13
+
4
14
  require 'intent/version'
15
+ require 'intent/core'
16
+ require 'intent/commands'
17
+ # require 'intent/todo'
18
+ # require 'intent/review'
19
+ # require 'intent/projects'
20
+ # require 'intent/desktop'
21
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2024-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: todo-txt
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.11'
19
+ version: '0.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.11'
26
+ version: '0.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pastel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '0.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: '0.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: git
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: 1.19.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.0
54
+ version: 1.19.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: terminal-notifier
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.8.0
61
+ version: '2.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.8.0
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ghost
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,33 +81,159 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.0.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: bundler
84
+ name: unicode_plot
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.0.5
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.0.5
97
+ - !ruby/object:Gem::Dependency
98
+ name: kdl
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.3
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.3
111
+ - !ruby/object:Gem::Dependency
112
+ name: sorted_set
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.3
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.0.3
125
+ - !ruby/object:Gem::Dependency
126
+ name: strings-ansi
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.2.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.2.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: bibtex-ruby
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 6.1.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 6.1.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: tty-prompt
85
155
  requirement: !ruby/object:Gem::Requirement
86
156
  requirements:
87
157
  - - "~>"
88
158
  - !ruby/object:Gem::Version
89
- version: '1.10'
90
- type: :development
159
+ version: 0.23.1
160
+ type: :runtime
91
161
  prerelease: false
92
162
  version_requirements: !ruby/object:Gem::Requirement
93
163
  requirements:
94
164
  - - "~>"
95
165
  - !ruby/object:Gem::Version
96
- version: '1.10'
166
+ version: 0.23.1
97
167
  - !ruby/object:Gem::Dependency
98
- name: rake
168
+ name: tty-table
99
169
  requirement: !ruby/object:Gem::Requirement
100
170
  requirements:
101
171
  - - "~>"
102
172
  - !ruby/object:Gem::Version
103
- version: '10.0'
104
- type: :development
173
+ version: 0.12.0
174
+ type: :runtime
105
175
  prerelease: false
106
176
  version_requirements: !ruby/object:Gem::Requirement
107
177
  requirements:
108
178
  - - "~>"
109
179
  - !ruby/object:Gem::Version
110
- version: '10.0'
180
+ version: 0.12.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: tty-tree
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: 0.4.0
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: 0.4.0
195
+ - !ruby/object:Gem::Dependency
196
+ name: nanoid
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: 2.0.0
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: 2.0.0
209
+ - !ruby/object:Gem::Dependency
210
+ name: bundler
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: rake
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
111
237
  - !ruby/object:Gem::Dependency
112
238
  name: rspec
113
239
  requirement: !ruby/object:Gem::Requirement
@@ -122,42 +248,64 @@ dependencies:
122
248
  - - ">="
123
249
  - !ruby/object:Gem::Version
124
250
  version: '0'
125
- description:
251
+ description:
126
252
  email:
127
253
  - me@maetl.net
128
254
  executables:
255
+ - intent
256
+ - inventory
257
+ - project_doc
129
258
  - projects
130
- - review
259
+ - projects_active
131
260
  - todo
261
+ - todo_review
132
262
  extensions: []
133
263
  extra_rdoc_files: []
134
264
  files:
135
265
  - ".gitignore"
136
- - ".travis.yml"
137
- - CODE_OF_CONDUCT.md
138
266
  - Gemfile
139
267
  - LICENSE.txt
140
268
  - README.md
141
269
  - Rakefile
270
+ - bin/intent
271
+ - bin/inventory
272
+ - bin/project_doc
142
273
  - bin/projects
143
- - bin/review
274
+ - bin/projects_active
144
275
  - bin/todo
276
+ - bin/todo_review
145
277
  - intent.gemspec
146
278
  - lib/gem_ext/todo-txt.rb
147
279
  - lib/intent.rb
280
+ - lib/intent/commands.rb
281
+ - lib/intent/commands/base.rb
282
+ - lib/intent/commands/errors.rb
283
+ - lib/intent/commands/intent.rb
284
+ - lib/intent/commands/inventory.rb
285
+ - lib/intent/commands/projects.rb
286
+ - lib/intent/commands/todo.rb
287
+ - lib/intent/core.rb
288
+ - lib/intent/desktop.rb
148
289
  - lib/intent/projects.rb
149
- - lib/intent/projects/manager.rb
150
- - lib/intent/projects/status.rb
151
290
  - lib/intent/review.rb
152
- - lib/intent/review/manager.rb
291
+ - lib/intent/text/inventory.help.txt
292
+ - lib/intent/text/project.help.txt
293
+ - lib/intent/text/projects.help.txt
294
+ - lib/intent/text/todo.help.txt
153
295
  - lib/intent/todo.rb
154
- - lib/intent/todo/manager.rb
296
+ - lib/intent/ui/ttyui.rb
297
+ - lib/intent/verbs/add.rb
298
+ - lib/intent/verbs/cite.rb
299
+ - lib/intent/verbs/install.rb
300
+ - lib/intent/verbs/review.rb
301
+ - lib/intent/verbs/status.rb
302
+ - lib/intent/verbs/todo.rb
155
303
  - lib/intent/version.rb
156
304
  homepage: http://maetl.net
157
305
  licenses:
158
306
  - MIT
159
307
  metadata: {}
160
- post_install_message:
308
+ post_install_message:
161
309
  rdoc_options: []
162
310
  require_paths:
163
311
  - lib
@@ -172,9 +320,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
320
  - !ruby/object:Gem::Version
173
321
  version: '0'
174
322
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.7.6
177
- signing_key:
323
+ rubygems_version: 3.3.7
324
+ signing_key:
178
325
  specification_version: 4
179
326
  summary: Text-based project management
180
327
  test_files: []
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.3
4
- before_install: gem install bundler -v 1.10.6
data/CODE_OF_CONDUCT.md DELETED
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
@@ -1,20 +0,0 @@
1
- module Intent
2
- module Projects
3
- class Manager
4
- def self.run(args, output=STDOUT)
5
- if args.empty?
6
- print_help(output)
7
- else
8
- case args.first.to_sym
9
- when :status
10
- Status.run(File.expand_path('~/Projects').to_s)
11
- end
12
- end
13
- end
14
-
15
- def self.print_help(output)
16
- output.puts "usage: review"
17
- end
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- module Intent
2
- module Review
3
- class Manager
4
- def self.run(args, output=STDOUT)
5
- if args.empty?
6
- print_help(output)
7
- else
8
- puts args
9
- end
10
- end
11
-
12
- def self.print_help(output)
13
- output.puts "usage: review"
14
- end
15
- end
16
- end
17
- end
File without changes