fatty 0.99.0 → 0.99.3
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 +4 -4
- data/CHANGELOG.org +11 -29
- data/README.md +2207 -18
- data/README.org +2066 -104
- data/exe/fatty +236 -93
- data/help/help.md +233 -0
- data/lib/fatty/action.rb +3 -7
- data/lib/fatty/actionable.rb +2 -0
- data/lib/fatty/alert.rb +65 -39
- data/lib/fatty/ansi/renderer.rb +26 -6
- data/lib/fatty/ansi.rb +1 -0
- data/lib/fatty/api/alert.rb +15 -0
- data/lib/fatty/api/choose.rb +145 -0
- data/lib/fatty/api/environment.rb +12 -0
- data/lib/fatty/api/keytest.rb +11 -0
- data/lib/fatty/api/menu.rb +104 -0
- data/lib/fatty/api/output.rb +55 -0
- data/lib/fatty/api/progress.rb +24 -0
- data/lib/fatty/api/prompt.rb +77 -0
- data/lib/fatty/api/status.rb +55 -0
- data/lib/fatty/api.rb +38 -0
- data/lib/fatty/callback_environment.rb +74 -0
- data/lib/fatty/colors/color.rb +366 -232
- data/lib/fatty/colors/pairs.rb +2 -0
- data/lib/fatty/command.rb +78 -0
- data/lib/fatty/config.rb +227 -39
- data/lib/fatty/config_files/config.yml +4 -12
- data/lib/fatty/config_files/keydefs.yml +13 -23
- data/lib/fatty/config_files/themes/capuchin_monk.yml +140 -0
- data/lib/fatty/config_files/themes/catppuccin_latte.yml +140 -0
- data/lib/fatty/config_files/themes/catppuccin_mocha.yml +140 -0
- data/lib/fatty/config_files/themes/cyberpunk.yml +141 -0
- data/lib/fatty/config_files/themes/dracula.yml +140 -0
- data/lib/fatty/config_files/themes/everforest_dark.yml +140 -0
- data/lib/fatty/config_files/themes/gruvbox_dark.yml +140 -0
- data/lib/fatty/config_files/themes/gruvbox_light.yml +140 -0
- data/lib/fatty/config_files/themes/mono.yml +119 -47
- data/lib/fatty/config_files/themes/monokai.yml +140 -0
- data/lib/fatty/config_files/themes/nordic.yml +1 -0
- data/lib/fatty/config_files/themes/onedark.yml +140 -0
- data/lib/fatty/config_files/themes/solarized_dark.yml +1 -0
- data/lib/fatty/config_files/themes/solarized_light.yml +140 -0
- data/lib/fatty/config_files/themes/terminal.yml +67 -0
- data/lib/fatty/config_files/themes/tokyo_night.yml +140 -0
- data/lib/fatty/config_files/themes/wordperfect.yml +80 -9
- data/lib/fatty/core_ext/hash.rb +19 -0
- data/lib/fatty/core_ext/string.rb +19 -12
- data/lib/fatty/core_ext.rb +1 -0
- data/lib/fatty/curses/context.rb +86 -84
- data/lib/fatty/curses/event_source.rb +128 -40
- data/lib/fatty/curses/key_decoder.rb +77 -11
- data/lib/fatty/env.rb +21 -20
- data/lib/fatty/help.rb +1 -29
- data/lib/fatty/history/entry.rb +2 -0
- data/lib/fatty/history.rb +17 -14
- data/lib/fatty/input_buffer.rb +71 -47
- data/lib/fatty/input_field.rb +216 -149
- data/lib/fatty/key_event.rb +67 -66
- data/lib/fatty/key_map.rb +54 -16
- data/lib/fatty/keymaps/emacs.rb +40 -6
- data/lib/fatty/log_formats/json.rb +2 -0
- data/lib/fatty/log_formats/text.rb +2 -0
- data/lib/fatty/logger.rb +7 -2
- data/lib/fatty/markdown/ansi_renderer.rb +75 -6
- data/lib/fatty/markdown/render.rb +2 -3
- data/lib/fatty/mouse_event.rb +142 -2
- data/lib/fatty/output_buffer.rb +2 -0
- data/lib/fatty/pager.rb +158 -47
- data/lib/fatty/progress.rb +417 -0
- data/lib/fatty/renderer/curses.rb +340 -184
- data/lib/fatty/renderer/truecolor.rb +266 -163
- data/lib/fatty/renderer.rb +115 -97
- data/lib/fatty/screen.rb +2 -0
- data/lib/fatty/session/alert_session.rb +39 -21
- data/lib/fatty/session/isearch_session.rb +92 -38
- data/lib/fatty/session/keytest_session.rb +105 -85
- data/lib/fatty/session/modal_session.rb +38 -1
- data/lib/fatty/session/output_session.rb +472 -21
- data/lib/fatty/session/popup_session.rb +251 -134
- data/lib/fatty/session/prompt_session.rb +68 -26
- data/lib/fatty/session/search_session.rb +79 -31
- data/lib/fatty/session/shell_session.rb +383 -368
- data/lib/fatty/session/status_session.rb +167 -0
- data/lib/fatty/session.rb +95 -95
- data/lib/fatty/terminal/popup_owner.rb +14 -11
- data/lib/fatty/terminal.rb +515 -813
- data/lib/fatty/themes/loader.rb +4 -2
- data/lib/fatty/themes/manager.rb +4 -0
- data/lib/fatty/themes/registry.rb +2 -0
- data/lib/fatty/themes/resolver.rb +175 -162
- data/lib/fatty/version.rb +1 -1
- data/lib/fatty/viewport.rb +8 -1
- data/lib/fatty.rb +35 -7
- metadata +42 -40
- data/.envrc +0 -2
- data/.simplecov +0 -23
- data/.yardopts +0 -4
- data/CHANGELOG.md +0 -34
- data/Rakefile +0 -15
- data/TODO.org +0 -163
- data/examples/markdown/native-markdown.md +0 -370
- data/examples/markdown/ox-gfm-markdown.md +0 -373
- data/examples/markdown/ox-gfm-markdown.org +0 -376
- data/fatty.gemspec +0 -42
- data/lib/fatty/accept_env.rb +0 -32
- data/lib/fatty/config_files/help.md +0 -120
- data/lib/fatty/config_files/help.org +0 -124
- data/lib/fatty/config_files/themes/wordperfect_light.yml +0 -77
- data/lib/fatty/menu_env.rb +0 -22
- data/lib/fatty/session/input_session.rb +0 -99
- data/lib/fatty/sessions.rb +0 -14
- data/lib/fatty/terminal/progress.rb +0 -374
- data/lib/fatty/view/alert_view.rb +0 -14
- data/lib/fatty/view/cursor_view.rb +0 -18
- data/lib/fatty/view/input_view.rb +0 -9
- data/lib/fatty/view/output_view.rb +0 -9
- data/lib/fatty/view/status_view.rb +0 -14
- data/lib/fatty/view.rb +0 -33
- data/lib/fatty/views.rb +0 -9
- data/sig/fatty.rbs +0 -4
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
#+TITLE: Markdown Demonstration
|
|
2
|
-
#+OPTIONS: toc:0
|
|
3
|
-
|
|
4
|
-
* H1 heading should be red on yellow and bold
|
|
5
|
-
|
|
6
|
-
** H2 heading should be black on pink and bold
|
|
7
|
-
|
|
8
|
-
*** H3 heading should be magenta on lightyellow and underlined
|
|
9
|
-
|
|
10
|
-
This paragraph has *strong text*, /emphasized text/, ~inline code~,
|
|
11
|
-
==highlighted text==, and [fatty on github](https://github.com/ddoherty03/fatty).
|
|
12
|
-
|
|
13
|
-
Autolink: https://github.com/ddoherty03/fat_config
|
|
14
|
-
|
|
15
|
-
#+begin_quote
|
|
16
|
-
This block quote should have a red quote gutter.
|
|
17
|
-
The quoted text itself can stay normal output for now.
|
|
18
|
-
#+end_quote
|
|
19
|
-
|
|
20
|
-
#+begin_src ruby
|
|
21
|
-
# This ruby block. Has comments.
|
|
22
|
-
# Two lines, in fact.
|
|
23
|
-
def hello(name)
|
|
24
|
-
puts "hello #{name}"
|
|
25
|
-
end
|
|
26
|
-
#+end_src
|
|
27
|
-
|
|
28
|
-
| Feature | Expected style |
|
|
29
|
-
|--------------+---------------------|
|
|
30
|
-
| Header cells | black on lightgreen |
|
|
31
|
-
| Body cells | normal output |
|
|
32
|
-
|
|
33
|
-
* Carnival of Constructs
|
|
34
|
-
These are samples of the kinds of constructs the ANSI renderer for =fatty= are
|
|
35
|
-
capable of.
|
|
36
|
-
|
|
37
|
-
** Unordered Lists
|
|
38
|
-
|
|
39
|
-
- builtin commands are handled by the =fatty= demo, Four score and seven years
|
|
40
|
-
ago our fathers brought forth on this continent, a new nation, conceived in
|
|
41
|
-
Liberty, and dedicated to the proposition that all men are created equal.
|
|
42
|
-
- other commands are handled by =/bin/sh=
|
|
43
|
-
- keybindings are listed below
|
|
44
|
-
|
|
45
|
-
** Ordered Lists
|
|
46
|
-
|
|
47
|
-
1. builtin commands are handled by the =fatty= demo, Four score and seven years
|
|
48
|
-
ago our fathers brought forth on this continent, a new nation, conceived in
|
|
49
|
-
Liberty, and dedicated to the proposition that all men are created equal.
|
|
50
|
-
2. other commands are handled by =/bin/sh=
|
|
51
|
-
3. keybindings are listed below
|
|
52
|
-
|
|
53
|
-
Some regular text to break things up.
|
|
54
|
-
|
|
55
|
-
1. Parent ordered item
|
|
56
|
-
1. Child ordered item
|
|
57
|
-
2. Another child ordered item
|
|
58
|
-
2. Back to parent ordered item
|
|
59
|
-
|
|
60
|
-
** Description Lists
|
|
61
|
-
|
|
62
|
-
- bold :: *this text is bold*
|
|
63
|
-
- italic :: /this text is italic/
|
|
64
|
-
- code :: ~this text is code~
|
|
65
|
-
- verbatim :: =this text is verbatim=
|
|
66
|
-
- strike :: +this text is strike-through+
|
|
67
|
-
- underline :: _this text is underlined_
|
|
68
|
-
|
|
69
|
-
** A Code Block
|
|
70
|
-
#+begin_src ruby
|
|
71
|
-
def wrap(text, first_prefix: "", rest_prefix: first_prefix)
|
|
72
|
-
width = [@width.to_i, 20].max
|
|
73
|
-
|
|
74
|
-
words = text.to_s.split(/\s+/)
|
|
75
|
-
lines = []
|
|
76
|
-
line = +""
|
|
77
|
-
|
|
78
|
-
words.each do |word|
|
|
79
|
-
prefix = lines.empty? ? first_prefix : rest_prefix
|
|
80
|
-
available = width - Fatty::Ansi.visible_length(prefix)
|
|
81
|
-
available = 20 if available < 20
|
|
82
|
-
|
|
83
|
-
candidate = line.empty? ? word : "#{line} #{word}"
|
|
84
|
-
|
|
85
|
-
if Fatty::Ansi.visible_length(candidate) > available && !line.empty?
|
|
86
|
-
lines << "#{prefix}#{line}"
|
|
87
|
-
line = word.dup
|
|
88
|
-
else
|
|
89
|
-
line = candidate
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
unless line.empty?
|
|
94
|
-
prefix = lines.empty? ? first_prefix : rest_prefix
|
|
95
|
-
lines << "#{prefix}#{line}"
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
lines.join("\n")
|
|
99
|
-
end
|
|
100
|
-
#+end_src
|
|
101
|
-
|
|
102
|
-
** Nested lists
|
|
103
|
-
|
|
104
|
-
- Parent item
|
|
105
|
-
+ Child item
|
|
106
|
-
+ Another child
|
|
107
|
-
- Back to parent
|
|
108
|
-
|
|
109
|
-
** Links
|
|
110
|
-
|
|
111
|
-
[Fatty on GitHub](https://github.com/ddoherty03/fatty)
|
|
112
|
-
|
|
113
|
-
** Block quotes
|
|
114
|
-
|
|
115
|
-
#+begin_quote
|
|
116
|
-
Four score and seven years ago our fathers brought forth on this continent,
|
|
117
|
-
a new nation, conceived in Liberty, and dedicated to the proposition that
|
|
118
|
-
all men are created equal.
|
|
119
|
-
|
|
120
|
-
Now we are engaged in a great civil war, testing whether that nation, or any
|
|
121
|
-
nation so conceived and so dedicated, can long endure. We are met on a
|
|
122
|
-
great battle-field of that war. We have come to dedicate a portion of that
|
|
123
|
-
field, as a final resting place for those who here gave their lives that
|
|
124
|
-
that nation might live. It is altogether fitting and proper that we should
|
|
125
|
-
do this.
|
|
126
|
-
|
|
127
|
-
But, in a larger sense, we can not dedicate---we can not consecrate---we can
|
|
128
|
-
not hallow---this ground. The brave men, living and dead, who struggled
|
|
129
|
-
here, have consecrated it, far above our poor power to add or detract. The
|
|
130
|
-
world will little note, nor long remember what we say here, but it can never
|
|
131
|
-
forget what they did here. It is for us the living, rather, to be dedicated
|
|
132
|
-
here to the unfinished work which they who fought here have thus far so
|
|
133
|
-
nobly advanced. It is rather for us to be here dedicated to the great task
|
|
134
|
-
remaining before us---that from these honored dead we take increased
|
|
135
|
-
devotion to that cause for which they gave the last full measure of
|
|
136
|
-
devotion---that we here highly resolve that these dead shall not have died
|
|
137
|
-
in vain---that this nation, under God, shall have a new birth of
|
|
138
|
-
freedom---and that government of the people, by the people, for the people,
|
|
139
|
-
shall not perish from the earth.
|
|
140
|
-
#+end_quote
|
|
141
|
-
|
|
142
|
-
** Tables with styled cells
|
|
143
|
-
|
|
144
|
-
| Feature | Example |
|
|
145
|
-
|---------+---------------|
|
|
146
|
-
| bold | *bold cell* |
|
|
147
|
-
| code | ~code cell~ |
|
|
148
|
-
| strike | +strike cell+ |
|
|
149
|
-
|
|
150
|
-
** Horizontal Rule
|
|
151
|
-
This should be a horizontal rule, but YMMV.
|
|
152
|
-
|
|
153
|
-
-----
|
|
154
|
-
|
|
155
|
-
** Forced Line Break
|
|
156
|
-
|
|
157
|
-
This line has a forced line break<br>
|
|
158
|
-
and this should appear on the next line.
|
|
159
|
-
|
|
160
|
-
** Fenced code with various languages
|
|
161
|
-
|
|
162
|
-
Here is the Fibonacci number computed recursively in various languages.
|
|
163
|
-
|
|
164
|
-
*** Ruby
|
|
165
|
-
|
|
166
|
-
#+begin_src ruby
|
|
167
|
-
def fib(n)
|
|
168
|
-
return n if n < 2
|
|
169
|
-
|
|
170
|
-
fib(n - 1) + fib(n - 2)
|
|
171
|
-
end
|
|
172
|
-
puts fib(10)
|
|
173
|
-
#+end_src
|
|
174
|
-
|
|
175
|
-
*** Python
|
|
176
|
-
|
|
177
|
-
#+begin_src python
|
|
178
|
-
def fib(n):
|
|
179
|
-
if n < 2:
|
|
180
|
-
return n
|
|
181
|
-
|
|
182
|
-
return fib(n - 1) + fib(n - 2)
|
|
183
|
-
|
|
184
|
-
print(fib(10))
|
|
185
|
-
|
|
186
|
-
#+end_src
|
|
187
|
-
|
|
188
|
-
*** C
|
|
189
|
-
|
|
190
|
-
#+begin_src c
|
|
191
|
-
#include <stdio.h>
|
|
192
|
-
|
|
193
|
-
int fib(int n)
|
|
194
|
-
{
|
|
195
|
-
if (n < 2) {
|
|
196
|
-
return n;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return fib(n - 1) + fib(n - 2);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
int main(void)
|
|
203
|
-
{
|
|
204
|
-
printf("%d\n", fib(10));
|
|
205
|
-
return 0;
|
|
206
|
-
}
|
|
207
|
-
#+end_src
|
|
208
|
-
|
|
209
|
-
*** C++
|
|
210
|
-
|
|
211
|
-
#+begin_src cpp
|
|
212
|
-
#include <iostream>
|
|
213
|
-
|
|
214
|
-
int fib(int n)
|
|
215
|
-
{
|
|
216
|
-
if (n < 2) {
|
|
217
|
-
return n;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return fib(n - 1) + fib(n - 2);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
int main()
|
|
224
|
-
{
|
|
225
|
-
std::cout << fib(10) << std::endl;
|
|
226
|
-
}
|
|
227
|
-
#+end_src
|
|
228
|
-
|
|
229
|
-
*** Go
|
|
230
|
-
|
|
231
|
-
#+begin_src go
|
|
232
|
-
package main
|
|
233
|
-
|
|
234
|
-
import "fmt"
|
|
235
|
-
|
|
236
|
-
func fib(n int) int {
|
|
237
|
-
if n < 2 {
|
|
238
|
-
return n
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return fib(n-1) + fib(n-2)
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
func main() {
|
|
245
|
-
fmt.Println(fib(10))
|
|
246
|
-
}
|
|
247
|
-
#+end_src
|
|
248
|
-
|
|
249
|
-
*** Rust
|
|
250
|
-
|
|
251
|
-
#+begin_src rust
|
|
252
|
-
fn fib(n: u32) -> u32 {
|
|
253
|
-
if n < 2 {
|
|
254
|
-
n
|
|
255
|
-
} else {
|
|
256
|
-
fib(n - 1) + fib(n - 2)
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
fn main() {
|
|
261
|
-
println!("{}", fib(10));
|
|
262
|
-
}
|
|
263
|
-
#+end_src
|
|
264
|
-
|
|
265
|
-
*** PHP
|
|
266
|
-
|
|
267
|
-
#+begin_src php
|
|
268
|
-
<?php
|
|
269
|
-
|
|
270
|
-
function fib($n)
|
|
271
|
-
{
|
|
272
|
-
if ($n < 2) {
|
|
273
|
-
return $n;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return fib($n - 1) + fib($n - 2);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
echo fib(10) . PHP_EOL;
|
|
280
|
-
#+end_src
|
|
281
|
-
|
|
282
|
-
*** JavaScript
|
|
283
|
-
|
|
284
|
-
#+begin_src javascript
|
|
285
|
-
function fib(n) {
|
|
286
|
-
if (n < 2) {
|
|
287
|
-
return n;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return fib(n - 1) + fib(n - 2);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
console.log(fib(10));
|
|
294
|
-
#+end_src
|
|
295
|
-
|
|
296
|
-
*** TypeScript
|
|
297
|
-
|
|
298
|
-
#+begin_src typescript
|
|
299
|
-
function fib(n: number): number {
|
|
300
|
-
if (n < 2) {
|
|
301
|
-
return n;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
return fib(n - 1) + fib(n - 2);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
console.log(fib(10));
|
|
308
|
-
#+end_src
|
|
309
|
-
|
|
310
|
-
*** Java
|
|
311
|
-
|
|
312
|
-
#+begin_src java
|
|
313
|
-
public class Fib {
|
|
314
|
-
static int fib(int n) {
|
|
315
|
-
if (n < 2) {
|
|
316
|
-
return n;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return fib(n - 1) + fib(n - 2);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
public static void main(String[] args) {
|
|
323
|
-
System.out.println(fib(10));
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
#+end_src
|
|
327
|
-
|
|
328
|
-
*** Shell
|
|
329
|
-
|
|
330
|
-
#+begin_src bash
|
|
331
|
-
fib() {
|
|
332
|
-
if [ "$1" -lt 2 ]; then
|
|
333
|
-
echo "$1"
|
|
334
|
-
else
|
|
335
|
-
a=$(fib $(($1 - 1)))
|
|
336
|
-
b=$(fib $(($1 - 2)))
|
|
337
|
-
echo $((a + b))
|
|
338
|
-
fi
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
fib 10
|
|
342
|
-
#+end_src
|
|
343
|
-
|
|
344
|
-
*** Haskell
|
|
345
|
-
|
|
346
|
-
#+begin_src haskell
|
|
347
|
-
fib :: Int -> Int
|
|
348
|
-
fib n
|
|
349
|
-
| n < 2 = n
|
|
350
|
-
| otherwise = fib (n - 1) + fib (n - 2)
|
|
351
|
-
|
|
352
|
-
main :: IO ()
|
|
353
|
-
main = print (fib 10)
|
|
354
|
-
#+end_src
|
|
355
|
-
|
|
356
|
-
*** SQL (Recursive CTE)
|
|
357
|
-
|
|
358
|
-
#+begin_src sql
|
|
359
|
-
WITH RECURSIVE fib(n, a, b) AS (
|
|
360
|
-
SELECT 0, 0, 1
|
|
361
|
-
UNION ALL
|
|
362
|
-
SELECT n + 1, b, a + b
|
|
363
|
-
FROM fib
|
|
364
|
-
WHERE n < 10
|
|
365
|
-
)
|
|
366
|
-
SELECT a
|
|
367
|
-
FROM fib
|
|
368
|
-
ORDER BY n DESC
|
|
369
|
-
LIMIT 1;
|
|
370
|
-
#+end_src
|
|
371
|
-
|
|
372
|
-
*** Nonsense Language
|
|
373
|
-
|
|
374
|
-
#+begin_src madeuplang
|
|
375
|
-
this should still render as plain text
|
|
376
|
-
#+end_src
|
data/fatty.gemspec
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "lib/fatty/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "fatty"
|
|
7
|
-
spec.version = Fatty::VERSION
|
|
8
|
-
spec.authors = ["Daniel E. Doherty"]
|
|
9
|
-
spec.email = ["ded@ddoherty.net"]
|
|
10
|
-
|
|
11
|
-
spec.summary = "Stateful terminal UI with editable input and scrollback"
|
|
12
|
-
spec.description = <<~DESC
|
|
13
|
-
fatty is a pure Ruby curses-backed terminal interaction library with editable single-line input, scrollable output, and
|
|
14
|
-
programmable keybindings, inspired by modern shells like fish.
|
|
15
|
-
DESC
|
|
16
|
-
spec.homepage = "https://github.com/ddoherty03/fatty"
|
|
17
|
-
spec.license = "MIT"
|
|
18
|
-
spec.required_ruby_version = ">= 3.2.0"
|
|
19
|
-
|
|
20
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
21
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
22
|
-
spec.metadata["source_code_uri"] = "https://github.com/ddoherty03/fatty"
|
|
23
|
-
|
|
24
|
-
# Specify which files should be added to the gem when it is released.
|
|
25
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
26
|
-
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
|
|
27
|
-
ls.readlines("\x0", chomp: true).reject do |f|
|
|
28
|
-
f.start_with?(*%w[bin/ Gemfile .gitignore .rspec spec/ .github/ .rubocop.yml])
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
spec.bindir = "exe"
|
|
32
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
33
|
-
spec.require_paths = ["lib"]
|
|
34
|
-
|
|
35
|
-
spec.add_dependency "curses", "~> 1.4"
|
|
36
|
-
spec.add_dependency "fat_config", ">=0.8.0"
|
|
37
|
-
spec.add_dependency "unicode-display_width", "~> 2.5"
|
|
38
|
-
spec.add_dependency "yaml"
|
|
39
|
-
spec.add_dependency "rainbow"
|
|
40
|
-
spec.add_dependency "redcarpet"
|
|
41
|
-
spec.add_dependency "rouge"
|
|
42
|
-
end
|
data/lib/fatty/accept_env.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# This class provides a wrapper around components that can be handed off to
|
|
4
|
-
# Terminal's on_accept method for access to the terminal, the session, and a
|
|
5
|
-
# Progress widget.
|
|
6
|
-
module Fatty
|
|
7
|
-
class AcceptEnv
|
|
8
|
-
attr_reader :session
|
|
9
|
-
|
|
10
|
-
def initialize(session:)
|
|
11
|
-
@session = session
|
|
12
|
-
@progress = nil
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def terminal
|
|
16
|
-
session.terminal
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def progress(**opts)
|
|
20
|
-
@progress ||= Fatty::Terminal::Progress.new(terminal: terminal, **opts)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def markdown(text)
|
|
24
|
-
md = Fatty::Markdown.render(
|
|
25
|
-
text,
|
|
26
|
-
width: terminal.screen.cols,
|
|
27
|
-
palette: terminal.renderer.palette,
|
|
28
|
-
)
|
|
29
|
-
session.append_output(md)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Fatty Help
|
|
2
|
-
|
|
3
|
-
## The `fatty` demo command
|
|
4
|
-
|
|
5
|
-
When you run `fatty`, it operates as a simple demo of the `fatty` gem by
|
|
6
|
-
presenting an editable command-line using emacs key bindings. It has several
|
|
7
|
-
builtin commands to demonstrate `fatty` features, and any command it does not
|
|
8
|
-
recognized is handed off to the shell.
|
|
9
|
-
|
|
10
|
-
## Builtin commands
|
|
11
|
-
|
|
12
|
-
Here are the commands builtin to `fatty`
|
|
13
|
-
|
|
14
|
-
| Command | Description |
|
|
15
|
-
|:-----------------------------|:------------------------------------------------------------------------|
|
|
16
|
-
| help | Display this file on the output pane |
|
|
17
|
-
| cd | Change the current directory used by the shell |
|
|
18
|
-
| choose | Present a series of choices in a popup window |
|
|
19
|
-
| choosevals | Also present choices in a popup window but return an associated value |
|
|
20
|
-
| choose\_multi | Present choices with a "checkbox" for selecting multiple values |
|
|
21
|
-
| choosevals\_multi | Also present a checkbox but return associated values |
|
|
22
|
-
| menu | Present a menu of labeled routines to run |
|
|
23
|
-
| info | Display an "info" message on the status line |
|
|
24
|
-
| good | Display a "good" message colored to indicate success |
|
|
25
|
-
| warn | Display a "warn" message colored to indicate caution |
|
|
26
|
-
| oops | Display an "oops" message colored to indicate failure |
|
|
27
|
-
| prompt | Popup a text box for entering a value in response to a prompt |
|
|
28
|
-
| progress count <N> | Display an animated progress indicator counting up to 40 or the given N |
|
|
29
|
-
| progress percent <N> | Same but also show the percent complete |
|
|
30
|
-
| progress simple\_percent <N> | Same but show only the percent complete |
|
|
31
|
-
| progress trail | Show progress by displaying an "indicator" character for each step |
|
|
32
|
-
| progress bar | Show progress by a filling bar using ASCII characters |
|
|
33
|
-
| progress unicode\_bar | Same, but using unicode characters |
|
|
34
|
-
| progress braille\_bar | Same, but using braille characters |
|
|
35
|
-
| progress spinner | Animate a "spinner" showing a busy state |
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Keybindings
|
|
39
|
-
|
|
40
|
-
The following tables explain the keybindings available in `fatty` in different
|
|
41
|
-
contexts. Named keys are indicated by `:name` and key categories, such as
|
|
42
|
-
`<digits>` are indicated with brackets.
|
|
43
|
-
|
|
44
|
-
### Input Context
|
|
45
|
-
|
|
46
|
-
When editing the input line or text input for widgets like the `prompt`,
|
|
47
|
-
`fatty` provides emacs-like editing keybindings by default. Many of these
|
|
48
|
-
commands can take a count prefix argument to repeat the command count times.
|
|
49
|
-
For example, `M-8 M-0 #` will insert 80 '#' characters at the cursor.
|
|
50
|
-
|
|
51
|
-
| Key | Description |
|
|
52
|
-
|:-----------|:------------------------------------------------------|
|
|
53
|
-
| C-a | move to the beginning of the line |
|
|
54
|
-
| :home | move to the beginning of the line |
|
|
55
|
-
| C-e | move to the end of the line |
|
|
56
|
-
| :end | move to the end of the line |
|
|
57
|
-
| C-f | move cursor right one character |
|
|
58
|
-
| :right | move cursor right one character |
|
|
59
|
-
| C-b | move cursor left one character |
|
|
60
|
-
| :left | move cursor left one character |
|
|
61
|
-
| M-f | move cursor right one word |
|
|
62
|
-
| M-:right | move cursor right one word |
|
|
63
|
-
| C-:right | move cursor right one word |
|
|
64
|
-
| M-b | move cursor left one word |
|
|
65
|
-
| M-:left | move cursor left one word |
|
|
66
|
-
| C-:left | move cursor left one word |
|
|
67
|
-
| C-t | transpose characters |
|
|
68
|
-
| M-t | transpose words |
|
|
69
|
-
| | |
|
|
70
|
-
| C-d | delete character at cursor |
|
|
71
|
-
| :delete | delete character at cursor |
|
|
72
|
-
| :backspace | delete character before cursor |
|
|
73
|
-
| M-d | kill word at cursor |
|
|
74
|
-
| C-w | kill word before cursor |
|
|
75
|
-
| C-k | kill to end of line |
|
|
76
|
-
| | |
|
|
77
|
-
| C-/ | undo |
|
|
78
|
-
| C-_ | undo |
|
|
79
|
-
| C-M-/ | redo |
|
|
80
|
-
| M-/ | redo |
|
|
81
|
-
| | |
|
|
82
|
-
| C-:space | set the mark at the current cursor position |
|
|
83
|
-
| C-@ | set the mark at the current cursor position |
|
|
84
|
-
| C-g | clear the mark |
|
|
85
|
-
| C-w | kill the region |
|
|
86
|
-
| M-w | copy the region |
|
|
87
|
-
| | |
|
|
88
|
-
| C-y | yank last kill at cursor |
|
|
89
|
-
| M-y | replace last yank with next in kill ring |
|
|
90
|
-
| | |
|
|
91
|
-
| C-u | universal count argument (time 4 each press) |
|
|
92
|
-
| M-<digit> | accumulate count argument |
|
|
93
|
-
| | |
|
|
94
|
-
| C-p | replace the line with the prior history item |
|
|
95
|
-
| :up | replace the line with the prior history item |
|
|
96
|
-
| C-n | replace the line with the next history item |
|
|
97
|
-
| :down | replace the line with the prior history item |
|
|
98
|
-
| C-r | search the history in a popup |
|
|
99
|
-
| | |
|
|
100
|
-
| :enter | feed the line to the on_accept proc and page output |
|
|
101
|
-
| M-:enter | feed the line to the on_accept proc and scroll output |
|
|
102
|
-
| C-c | quit `fatty` |
|
|
103
|
-
| C-d | quit `fatty` only if the input line is empty |
|
|
104
|
-
| C-l | clear the output pane |
|
|
105
|
-
| | |
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
## Paging Context
|
|
109
|
-
|
|
110
|
-
By default, `fatty` sends output to the large output pane, and if the output
|
|
111
|
-
is more than one screen long presents a paging environment for viewing and
|
|
112
|
-
searching the environment.
|
|
113
|
-
|
|
114
|
-
| Key | Description |
|
|
115
|
-
|:------|:--------------------------|
|
|
116
|
-
| :up | move output one line up |
|
|
117
|
-
| k | move output one line up |
|
|
118
|
-
| :down | move output one line down |
|
|
119
|
-
| j | move output one line down |
|
|
120
|
-
| | |
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
* Fatty Help
|
|
2
|
-
** The =fatty= demo command
|
|
3
|
-
|
|
4
|
-
When you =fatty=, it operates as a simple demo of the =fatty= gem by
|
|
5
|
-
presenting an editable command-line using emacs key bindings. It has several
|
|
6
|
-
builtin commands to demonstrate =fatty= features, and any command it does not
|
|
7
|
-
recognized is handed off to the shell.
|
|
8
|
-
|
|
9
|
-
** Builtin commands
|
|
10
|
-
|
|
11
|
-
Here are the commands builtin to =fatty=
|
|
12
|
-
|
|
13
|
-
| Command | Description |
|
|
14
|
-
|-----------------------------+-------------------------------------------------------------------------|
|
|
15
|
-
| help | Display this file on the output pane |
|
|
16
|
-
| cd | Change the current directory used by the shell |
|
|
17
|
-
| choose | Present a series of choices in a popup window |
|
|
18
|
-
| choosevals | Also present choices in a popup window but return an associated value |
|
|
19
|
-
| choose_multi | Present choices with a "checkbox" for selecting multiple values |
|
|
20
|
-
| choosevals_multi | Also present a checkbox but return associated values |
|
|
21
|
-
| menu | Present a menu of labeled routines to run |
|
|
22
|
-
| info | Display an "info" message on the status line |
|
|
23
|
-
| good | Display a "good" message colored to indicate success |
|
|
24
|
-
| warn | Display a "warn" message colored to indicate caution |
|
|
25
|
-
| oops | Display an "oops" message colored to indicate failure |
|
|
26
|
-
| prompt | Popup a text box for entering a value in response to a prompt |
|
|
27
|
-
| progress count <N> | Display an animated progress indicator counting up to 40 or the given N |
|
|
28
|
-
| progress percent <N> | Same but also show the percent complete |
|
|
29
|
-
| progress simple_percent <N> | Same but show only the percent complete |
|
|
30
|
-
| progress trail | Show progress by displaying an "indicator" character for each step |
|
|
31
|
-
| progress bar | Show progress by a filling bar using ASCII characters |
|
|
32
|
-
| progress unicode_bar | Same, but using unicode characters |
|
|
33
|
-
| progress braille_bar | Same, but using braille characters |
|
|
34
|
-
| progress spinner | Animate a "spinner" showing a busy state |
|
|
35
|
-
| markdown <file.md> | Render the markdown file to the output pane; defaults to a demo file |
|
|
36
|
-
| keytest | Enter key diagnostic mode report keycodes, key names, and bindings |
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
** Keybindings
|
|
40
|
-
|
|
41
|
-
The following tables explain the keybindings available in `fatty` in different
|
|
42
|
-
contexts. Named keys are indicated by `:name` and key categories, such as
|
|
43
|
-
`<digits>` are indicated with brackets.
|
|
44
|
-
|
|
45
|
-
*** Input Context
|
|
46
|
-
|
|
47
|
-
When editing the input line or text input for widgets like the `prompt`,
|
|
48
|
-
`fatty` provides emacs-like editing keybindings by default. Many of these
|
|
49
|
-
commands can take a count prefix argument to repeat the command count times.
|
|
50
|
-
For example, `M-8 M-0 #` will insert 80 '#' characters at the cursor.
|
|
51
|
-
|
|
52
|
-
| Key | Description |
|
|
53
|
-
|------------+-------------------------------------------------------|
|
|
54
|
-
| C-a | move to the beginning of the line |
|
|
55
|
-
| :home | move to the beginning of the line |
|
|
56
|
-
| C-e | move to the end of the line |
|
|
57
|
-
| :end | move to the end of the line |
|
|
58
|
-
| C-f | move cursor right one character |
|
|
59
|
-
| :right | move cursor right one character |
|
|
60
|
-
| C-b | move cursor left one character |
|
|
61
|
-
| :left | move cursor left one character |
|
|
62
|
-
| M-f | move cursor right one word |
|
|
63
|
-
| M-:right | move cursor right one word |
|
|
64
|
-
| C-:right | move cursor right one word |
|
|
65
|
-
| M-b | move cursor left one word |
|
|
66
|
-
| M-:left | move cursor left one word |
|
|
67
|
-
| C-:left | move cursor left one word |
|
|
68
|
-
| C-t | transpose characters |
|
|
69
|
-
| M-t | transpose words |
|
|
70
|
-
| | |
|
|
71
|
-
| C-d | delete character at cursor |
|
|
72
|
-
| :delete | delete character at cursor |
|
|
73
|
-
| :backspace | delete character before cursor |
|
|
74
|
-
| M-d | kill word at cursor |
|
|
75
|
-
| C-w | kill word before cursor |
|
|
76
|
-
| C-k | kill to end of line |
|
|
77
|
-
| | |
|
|
78
|
-
| C-/ | undo |
|
|
79
|
-
| C-_ | undo |
|
|
80
|
-
| C-M-/ | redo |
|
|
81
|
-
| M-/ | redo |
|
|
82
|
-
| | |
|
|
83
|
-
| C-:space | set the mark at the current cursor position |
|
|
84
|
-
| C-@ | set the mark at the current cursor position |
|
|
85
|
-
| C-g | clear the mark |
|
|
86
|
-
| C-w | kill the region |
|
|
87
|
-
| M-w | copy the region |
|
|
88
|
-
| | |
|
|
89
|
-
| C-y | yank last kill at cursor |
|
|
90
|
-
| M-y | replace last yank with next in kill ring |
|
|
91
|
-
| | |
|
|
92
|
-
| C-u | universal count argument (time 4 each press) |
|
|
93
|
-
| M-<digit> | accumulate count argument |
|
|
94
|
-
| | |
|
|
95
|
-
| C-p | replace the line with the prior history item |
|
|
96
|
-
| :up | replace the line with the prior history item |
|
|
97
|
-
| C-n | replace the line with the next history item |
|
|
98
|
-
| :down | replace the line with the prior history item |
|
|
99
|
-
| C-r | search the history in a popup |
|
|
100
|
-
| | |
|
|
101
|
-
| :enter | feed the line to the on_accept proc and page output |
|
|
102
|
-
| M-:enter | feed the line to the on_accept proc and scroll output |
|
|
103
|
-
| C-c | quit `fatty` |
|
|
104
|
-
| C-d | quit `fatty` only if the input line is empty |
|
|
105
|
-
| C-l | clear the output pane |
|
|
106
|
-
| | |
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*** Paging Context
|
|
110
|
-
|
|
111
|
-
By default, `fatty` sends output to the large output pane, and if the output
|
|
112
|
-
is more than one screen long presents a paging environment for viewing and
|
|
113
|
-
searching the environment.
|
|
114
|
-
|
|
115
|
-
| Key | Description |
|
|
116
|
-
|-------+---------------------------|
|
|
117
|
-
| :up | move output one line up |
|
|
118
|
-
| k | move output one line up |
|
|
119
|
-
| :down | move output one line down |
|
|
120
|
-
| j | move output one line down |
|
|
121
|
-
| | |
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
** fatty on the Web
|