ruby-progress 1.2.0 β 1.3.1
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.md +76 -154
- data/DEMO_SCRIPTS.md +162 -0
- data/Gemfile.lock +1 -1
- data/README.md +128 -120
- data/Rakefile +7 -0
- data/bin/fill +10 -0
- data/bin/prg +76 -1024
- data/demo_screencast.rb +296 -0
- data/examples/daemon_job_example.sh +25 -0
- data/experimental_terminal.rb +7 -0
- data/lib/ruby-progress/cli/fill_options.rb +215 -0
- data/lib/ruby-progress/cli/job_cli.rb +99 -0
- data/lib/ruby-progress/cli/ripple_cli.rb +211 -0
- data/lib/ruby-progress/cli/ripple_options.rb +158 -0
- data/lib/ruby-progress/cli/twirl_cli.rb +173 -0
- data/lib/ruby-progress/cli/twirl_options.rb +147 -0
- data/lib/ruby-progress/cli/twirl_runner.rb +183 -0
- data/lib/ruby-progress/cli/twirl_spinner.rb +79 -0
- data/lib/ruby-progress/cli/worm_cli.rb +109 -0
- data/lib/ruby-progress/cli/worm_options.rb +173 -0
- data/lib/ruby-progress/cli/worm_runner.rb +282 -0
- data/lib/ruby-progress/daemon.rb +65 -0
- data/lib/ruby-progress/fill.rb +215 -0
- data/lib/ruby-progress/fill_cli.rb +249 -0
- data/lib/ruby-progress/output_capture.rb +136 -0
- data/lib/ruby-progress/ripple.rb +1 -0
- data/lib/ruby-progress/utils.rb +16 -2
- data/lib/ruby-progress/version.rb +8 -4
- data/lib/ruby-progress/worm.rb +2 -177
- data/lib/ruby-progress.rb +1 -0
- data/quick_demo.rb +134 -0
- data/readme_demo.rb +128 -0
- data/ruby-progress.gemspec +40 -0
- data/scripts/run_matrix_mise.fish +41 -0
- data/test_daemon_interruption.rb +2 -0
- data/test_daemon_orphan.rb +1 -0
- metadata +24 -1
data/README.md
CHANGED
|
@@ -8,6 +8,27 @@
|
|
|
8
8
|
|
|
9
9
|
This repository contains three different Ruby progress indicator projects: **Ripple**, **Worm**, and **Twirl**. All provide animated terminal progress indicators with different visual styles and features.
|
|
10
10
|
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [Unified Interface](#unified-interface)
|
|
14
|
+
- [Submitting jobs to a running daemon](#submitting-jobs-to-a-running-daemon)
|
|
15
|
+
- [Job result schema](#job-result-schema)
|
|
16
|
+
- [Example: start a daemon and send a job (simple)](#example-start-a-daemon-and-send-a-job-simple)
|
|
17
|
+
- [Ripple](#ripple)
|
|
18
|
+
- [Ripple Features](#ripple-features)
|
|
19
|
+
- [Ripple Usage](#ripple-usage)
|
|
20
|
+
- [Twirl](#twirl)
|
|
21
|
+
- [Worm](#worm)
|
|
22
|
+
- [Daemon mode (background indicator)](#daemon-mode-background-indicator)
|
|
23
|
+
- [Requirements](#requirements)
|
|
24
|
+
- [Installation](#installation)
|
|
25
|
+
- [Universal Utilities](#universal-utilities)
|
|
26
|
+
- [Terminal Control](#terminal-control)
|
|
27
|
+
- [Completion Messages](#completion-messages)
|
|
28
|
+
- [Development](#development)
|
|
29
|
+
- [Contributing](#contributing)
|
|
30
|
+
- [License](#license)
|
|
31
|
+
|
|
11
32
|
## Unified Interface
|
|
12
33
|
|
|
13
34
|
The gem provides a unified `prg` command that supports all progress indicators through subcommands:
|
|
@@ -25,119 +46,97 @@ prg ripple "Loading..." --style rainbow --speed fast
|
|
|
25
46
|
# Use twirl spinner animation
|
|
26
47
|
prg twirl --message "Working..." --style dots --speed fast
|
|
27
48
|
|
|
28
|
-
#
|
|
49
|
+
# Dedicated `fill` shim
|
|
50
|
+
# If you prefer a dedicated binary for the determinate progress bar, a thin `fill` shim is available that delegates to `prg fill`:
|
|
51
|
+
|
|
52
|
+
# Run fill directly (delegates to prg)
|
|
53
|
+
fill --report --percent 50
|
|
54
|
+
|
|
55
|
+
### With command execution
|
|
29
56
|
prg worm --command "sleep 5" --success "Completed!" --error "Failed!" --checkmark
|
|
30
57
|
prg ripple "Building..." --command "make build" --success "Build complete!" --stdout
|
|
31
58
|
prg twirl --command "npm install" --message "Installing packages" --style arc
|
|
59
|
+
prg fill --command "sleep 5" --success "Done!" --checkmark
|
|
32
60
|
|
|
33
|
-
|
|
61
|
+
### With start/end character decoration using --ends
|
|
34
62
|
prg ripple "Loading data" --ends "[]" --style rainbow
|
|
35
63
|
prg worm --message "Processing" --ends "()" --style blocks
|
|
36
64
|
prg twirl --message "Building" --ends "<<>>" --style dots
|
|
37
65
|
|
|
38
|
-
|
|
66
|
+
### Complex --ends patterns with emojis
|
|
39
67
|
prg worm --message "Magic" --ends "π―πͺ" --style "custom=π¦π¨π₯"
|
|
40
68
|
```
|
|
41
69
|
|
|
42
70
|
### Global Options
|
|
43
71
|
|
|
44
72
|
- `prg --help` - Show main help
|
|
45
|
-
- `prg --version` - Show version info
|
|
46
|
-
- `prg --list-styles` - Show all available styles for all subcommands
|
|
47
|
-
- `prg <subcommand> --help` - Show specific subcommand help
|
|
48
73
|
|
|
49
|
-
|
|
74
|
+
Notes:
|
|
75
|
+
|
|
76
|
+
- The CLI detaches itself (double-fork); do not append `&`. This prevents shell job notifications like βjob β¦ has ended.β The command returns immediately.
|
|
77
|
+
- `--stop-success` and `--stop-error` are mutually exclusive; whichever you provide determines the success state and icon if `--stop-checkmark` is set.
|
|
78
|
+
- The indicator clears its line on shutdown and prints the final message to STDOUT.
|
|
79
|
+
- `--stop-pid` is still supported for backward compatibility, but `--stop [--pid-file FILE]` is preferred.
|
|
50
80
|
|
|
51
|
-
|
|
52
|
-
- `--message MESSAGE` - Message to display
|
|
53
|
-
- `--command COMMAND` - Command to execute during animation
|
|
54
|
-
- `--success MESSAGE` - Success message after completion
|
|
55
|
-
- `--error MESSAGE` - Error message on failure
|
|
56
|
-
- `--checkmark` - Show checkmarks (β
success, π failure)
|
|
57
|
-
- `--stdout` - Output command results to STDOUT
|
|
58
|
-
- `--ends CHARS` - Start/end characters (even number of chars, split in half)
|
|
81
|
+
### Submitting jobs to a running daemon
|
|
59
82
|
|
|
60
|
-
|
|
83
|
+
When running a long-lived daemon (for example `prg worm --daemon`), you can submit additional commands to run and have their output displayed without disrupting the animation using the `prg job send` helper.
|
|
61
84
|
|
|
62
|
-
|
|
85
|
+
Basic usage:
|
|
63
86
|
|
|
64
87
|
```bash
|
|
65
|
-
#
|
|
66
|
-
prg
|
|
88
|
+
# Enqueue a command to the default daemon PID
|
|
89
|
+
prg job send --command "./deploy-step.sh"
|
|
67
90
|
|
|
68
|
-
#
|
|
69
|
-
prg
|
|
91
|
+
# Enqueue to a named daemon (creates /tmp/ruby-progress/<name>.pid)
|
|
92
|
+
prg job send --daemon-name mytask --command "rsync -av ./dist/ user@host:/srv/app"
|
|
70
93
|
|
|
71
|
-
#
|
|
94
|
+
# Read command from stdin (useful in scripts)
|
|
95
|
+
echo "bundle exec rake db:migrate" | prg job send --stdin --daemon-name mytask
|
|
72
96
|
|
|
73
|
-
#
|
|
74
|
-
prg
|
|
97
|
+
# Wait for the job result and print the job result JSON (default timeout 10s)
|
|
98
|
+
prg job send --daemon-name mytask --command "./deploy-step.sh" --wait --timeout 30
|
|
99
|
+
```
|
|
75
100
|
|
|
76
|
-
|
|
77
|
-
prg worm --stop-id mytask --stop-success "Task complete!" --stop-checkmark
|
|
101
|
+
Behavior and file layout:
|
|
78
102
|
|
|
79
|
-
|
|
80
|
-
|
|
103
|
+
- Jobs are written as JSON files into the daemon's job directory, which is derived from the daemon PID file. For example, a PID file `/tmp/ruby-progress/mytask.pid` maps to the job directory `/tmp/ruby-progress/mytask.jobs`.
|
|
104
|
+
- The CLI writes the job atomically by first writing a `*.json.tmp` temporary file and then renaming it to `*.json`.
|
|
105
|
+
- The daemon's job processor claims jobs atomically by renaming the job file to `*.processing`, writes a `*.processing.result` JSON file when finished, and moves processed jobs to `processed-*`.
|
|
81
106
|
|
|
82
|
-
|
|
83
|
-
prg worm --status
|
|
84
|
-
prg worm --status-id mytask
|
|
107
|
+
This mechanism allows you to submit many commands to a single running indicator and have their output shown in reserved terminal rows while the animation continues.
|
|
85
108
|
|
|
86
|
-
|
|
87
|
-
prg worm --daemon --pid-file /tmp/custom-progress.pid
|
|
88
|
-
prg worm --status --pid-file /tmp/custom-progress.pid
|
|
89
|
-
prg worm --stop-success "Complete" --pid-file /tmp/custom-progress.pid
|
|
90
|
-
```
|
|
109
|
+
## Job result schema
|
|
91
110
|
|
|
92
|
-
|
|
111
|
+
When a job is processed the daemon writes a small JSON result file next to the claimed job with the suffix `.processing.result` containing at least these keys:
|
|
93
112
|
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
- `--stop-pid` is still supported for backward compatibility, but `--stop [--pid-file FILE]` is preferred.
|
|
113
|
+
- `id` - the job id (string)
|
|
114
|
+
- `status` - `"done"` or `"error"`
|
|
115
|
+
- `time` - epoch seconds when the job finished (integer)
|
|
98
116
|
|
|
99
|
-
|
|
117
|
+
Depending on the job handler, additional keys may be present:
|
|
118
|
+
|
|
119
|
+
- `exit_status` - the numeric process exit status (integer or nil if unknown)
|
|
120
|
+
- `output` - a string with the last captured lines of output (if available)
|
|
121
|
+
- `error` - an error message when `status` is `error`
|
|
122
|
+
|
|
123
|
+
Example:
|
|
100
124
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
- [Ripple Library Usage](#ripple-library-usage)
|
|
113
|
-
- [Twirl](#twirl)
|
|
114
|
-
- [Twirl Features](#twirl-features)
|
|
115
|
-
- [Twirl Usage](#twirl-usage)
|
|
116
|
-
- [Command Line](#command-line)
|
|
117
|
-
- [Twirl Command Line Options](#twirl-command-line-options)
|
|
118
|
-
- [Available Spinner Styles](#available-spinner-styles)
|
|
119
|
-
- [Worm](#worm)
|
|
120
|
-
- [Worm Features](#worm-features)
|
|
121
|
-
- [Worm Usage](#worm-usage)
|
|
122
|
-
- [Command Line](#command-line-1)
|
|
123
|
-
- [Daemon mode (background indicator)](#daemon-mode-background-indicator)
|
|
124
|
-
- [Worm Command Line Options](#worm-command-line-options)
|
|
125
|
-
- [Worm Library Usage](#worm-library-usage)
|
|
126
|
-
- [Animation Styles](#animation-styles)
|
|
127
|
-
- [Circles](#circles)
|
|
128
|
-
- [Blocks](#blocks)
|
|
129
|
-
- [Geometric](#geometric)
|
|
130
|
-
- [Requirements](#requirements)
|
|
131
|
-
- [Installation](#installation)
|
|
132
|
-
- [As a Gem (Recommended)](#as-a-gem-recommended)
|
|
133
|
-
- [From Source](#from-source)
|
|
134
|
-
- [Development](#development)
|
|
135
|
-
- [Universal Utilities](#universal-utilities)
|
|
136
|
-
- [Terminal Control](#terminal-control)
|
|
137
|
-
- [Completion Messages](#completion-messages)
|
|
138
|
-
- [Contributing](#contributing)
|
|
139
|
-
- [License](#license)
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"id": "8a1f6c1e-4b7a-4f2c-b0a8-9e9f1c2f1a2b",
|
|
128
|
+
"status": "done",
|
|
129
|
+
"time": 1634044800,
|
|
130
|
+
"exit_status": 0,
|
|
131
|
+
"output": "Step 1 completed\nStep 2 completed"
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This file is intended for short messages and small captured output snippets (the CLI captures the last N lines). If you need larger logs, write them to a persistent file from the command itself and include a reference in the job metadata.
|
|
140
136
|
|
|
137
|
+
## Example: start a daemon and send a job (simple)
|
|
138
|
+
|
|
139
|
+
Below is an example script that demonstrates starting a worm daemon, sending a job, waiting for the result, and stopping the daemon.
|
|
141
140
|
---
|
|
142
141
|
|
|
143
142
|
## Ripple
|
|
@@ -159,19 +158,19 @@ Ripple is a sophisticated text animation library that creates ripple effects acr
|
|
|
159
158
|
#### Ripple CLI examples
|
|
160
159
|
|
|
161
160
|
```bash
|
|
162
|
-
|
|
161
|
+
### Basic text animation
|
|
163
162
|
prg ripple "Loading..."
|
|
164
163
|
|
|
165
|
-
|
|
164
|
+
### With style options
|
|
166
165
|
prg ripple "Processing Data" --speed fast --style rainbow --direction bidirectional
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
### Multiple styles combined
|
|
169
168
|
prg ripple "Loading..." --style rainbow,inverse
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
### Case transformation mode
|
|
172
171
|
prg ripple "Processing Text" --style caps,inverse
|
|
173
172
|
|
|
174
|
-
|
|
173
|
+
### Run a command with progress animation
|
|
175
174
|
prg ripple "Installing packages" --command "sleep 5" --success "Installation complete!" --checkmark
|
|
176
175
|
```
|
|
177
176
|
|
|
@@ -196,12 +195,12 @@ You can also use Ripple as a Ruby library:
|
|
|
196
195
|
```ruby
|
|
197
196
|
require 'ruby-progress'
|
|
198
197
|
|
|
199
|
-
|
|
198
|
+
### Simple progress block
|
|
200
199
|
result = RubyProgress::Ripple.progress("Processing...") do
|
|
201
200
|
sleep 5 # Your actual work here
|
|
202
201
|
end
|
|
203
202
|
|
|
204
|
-
|
|
203
|
+
### With options
|
|
205
204
|
rippler = RubyProgress::Ripple.new("Loading Data", {
|
|
206
205
|
speed: :fast,
|
|
207
206
|
format: :bidirectional,
|
|
@@ -236,24 +235,24 @@ Twirl is a lightweight spinner animation system providing over 35 different spin
|
|
|
236
235
|
#### Command Line
|
|
237
236
|
|
|
238
237
|
```bash
|
|
239
|
-
|
|
238
|
+
### Basic spinner animation
|
|
240
239
|
prg twirl --message "Processing..." --style dots
|
|
241
240
|
|
|
242
|
-
|
|
241
|
+
### With command execution
|
|
243
242
|
prg twirl --command "npm install" --message "Installing" --style arc
|
|
244
243
|
|
|
245
|
-
|
|
244
|
+
### Different spinner styles
|
|
246
245
|
prg twirl --message "Working" --style arrows --speed fast
|
|
247
246
|
prg twirl --message "Loading" --style blocks --speed slow
|
|
248
247
|
|
|
249
|
-
|
|
248
|
+
### With success/error handling
|
|
250
249
|
prg twirl --command "make build" --success "Build complete!" --error "Build failed!" --checkmark
|
|
251
250
|
|
|
252
|
-
|
|
251
|
+
### Daemon mode for background tasks
|
|
253
252
|
prg twirl --daemon --message "Background processing" --style geometric
|
|
254
253
|
prg twirl --daemon-as mytask --message "Named task" --style dots
|
|
255
254
|
|
|
256
|
-
|
|
255
|
+
### ... do other work ...
|
|
257
256
|
prg twirl --stop-success "Processing complete!"
|
|
258
257
|
prg twirl --stop-id mytask --stop-success "Task finished!"
|
|
259
258
|
```
|
|
@@ -312,39 +311,48 @@ Worm is a clean, Unicode-based progress indicator that creates a ripple effect u
|
|
|
312
311
|
#### Command Line
|
|
313
312
|
|
|
314
313
|
```bash
|
|
315
|
-
|
|
314
|
+
### Run indefinitely without a command (like ripple)
|
|
316
315
|
prg worm --message "Loading..." --speed fast --style circles
|
|
317
316
|
|
|
318
|
-
|
|
317
|
+
### Run a command with progress animation
|
|
319
318
|
prg worm --command "sleep 5" --message "Installing" --success "Done!"
|
|
320
319
|
|
|
321
|
-
|
|
320
|
+
### Customize the animation
|
|
322
321
|
prg worm --command "make build" --speed fast --length 5 --style blocks
|
|
323
322
|
|
|
324
|
-
|
|
323
|
+
### With custom error handling
|
|
325
324
|
prg worm --command "risky_operation" --error "Operation failed" --style geometric
|
|
326
325
|
|
|
327
|
-
|
|
326
|
+
### With checkmarks for visual feedback
|
|
328
327
|
prg worm --command "npm install" --success "Installation complete!" --checkmark
|
|
329
328
|
|
|
330
|
-
|
|
329
|
+
### Control animation direction (forward-only or bidirectional)
|
|
331
330
|
prg worm --message "Processing" --direction forward --style circles
|
|
332
331
|
prg worm --command "sleep 3" --direction bidirectional --style blocks
|
|
333
332
|
|
|
334
|
-
|
|
333
|
+
### Create custom animations with 3-character patterns
|
|
335
334
|
prg worm --message "Custom style" --style "custom=_-=" --command "sleep 2"
|
|
336
335
|
prg worm --message "Emoji worm!" --style "custom=π¦π¨π₯" --success "Complete!"
|
|
337
336
|
prg worm --message "Mixed chars" --style "custom=.π‘*" --direction forward
|
|
338
337
|
|
|
339
|
-
|
|
338
|
+
### Add start/end characters around the animation
|
|
340
339
|
prg worm --message "Bracketed" --ends "[]" --style circles
|
|
341
340
|
prg worm --message "Parentheses" --ends "()" --style blocks --direction forward
|
|
342
341
|
prg worm --message "Emoji ends" --ends "π―πͺ" --style "custom=π¦π¨π₯"
|
|
343
342
|
|
|
344
|
-
|
|
343
|
+
### Capture and display command output
|
|
345
344
|
prg worm --command "git status" --message "Checking status" --stdout
|
|
346
345
|
|
|
347
|
-
|
|
346
|
+
You can reserve terminal rows for captured command output so the animation doesn't interleave with the script output. Use:
|
|
347
|
+
|
|
348
|
+
- `--output-position POSITION` β `above` (default) or `below` the animation
|
|
349
|
+
- `--output-lines N` β how many terminal rows to reserve for captured output (default: 3)
|
|
350
|
+
|
|
351
|
+
Examples:
|
|
352
|
+
|
|
353
|
+
prg worm --command "git status" --stdout --output-position above --output-lines 4
|
|
354
|
+
|
|
355
|
+
### Combine checkmarks and stdout output
|
|
348
356
|
prg worm --command "echo 'Build output'" --success "Build complete!" --checkmark --stdout
|
|
349
357
|
```
|
|
350
358
|
|
|
@@ -353,18 +361,18 @@ prg worm --command "echo 'Build output'" --success "Build complete!" --checkmark
|
|
|
353
361
|
Run the worm indicator as a background daemon and stop it later (useful in shell scripts):
|
|
354
362
|
|
|
355
363
|
```bash
|
|
356
|
-
|
|
364
|
+
### Start in the background (default PID file: /tmp/ruby-progress/progress.pid)
|
|
357
365
|
prg worm --daemon
|
|
358
366
|
|
|
359
|
-
|
|
367
|
+
### ... run your tasks ...
|
|
360
368
|
|
|
361
|
-
|
|
369
|
+
### Stop using the default PID file
|
|
362
370
|
prg worm --stop
|
|
363
371
|
|
|
364
|
-
|
|
372
|
+
### Use a custom PID file
|
|
365
373
|
prg worm --daemon --pid-file /tmp/custom-worm.pid
|
|
366
374
|
|
|
367
|
-
|
|
375
|
+
### Stop using the matching custom PID file
|
|
368
376
|
prg worm --stop --pid-file /tmp/custom-worm.pid
|
|
369
377
|
```
|
|
370
378
|
|
|
@@ -399,7 +407,7 @@ Note: You donβt need `&` when starting the daemon. The command detaches itself
|
|
|
399
407
|
```ruby
|
|
400
408
|
require 'ruby-progress'
|
|
401
409
|
|
|
402
|
-
|
|
410
|
+
### Create and run animation with a block
|
|
403
411
|
worm = RubyProgress::Worm.new(
|
|
404
412
|
length: 4,
|
|
405
413
|
message: "Processing",
|
|
@@ -416,7 +424,7 @@ result = worm.animate(
|
|
|
416
424
|
some_long_running_task
|
|
417
425
|
end
|
|
418
426
|
|
|
419
|
-
|
|
427
|
+
### With custom style and forward direction
|
|
420
428
|
worm = RubyProgress::Worm.new(
|
|
421
429
|
message: "Custom animation",
|
|
422
430
|
style: 'custom=π΄π‘π’',
|
|
@@ -425,7 +433,7 @@ worm = RubyProgress::Worm.new(
|
|
|
425
433
|
|
|
426
434
|
result = worm.animate { sleep 3 }
|
|
427
435
|
|
|
428
|
-
|
|
436
|
+
### Or run with a command
|
|
429
437
|
worm = RubyProgress::Worm.new(command: "bundle install")
|
|
430
438
|
worm.run_with_command
|
|
431
439
|
```
|
|
@@ -457,16 +465,16 @@ Worm supports three built-in animation styles plus custom patterns:
|
|
|
457
465
|
Create your own animation patterns using the `custom=XXX` format, where `XXX` is a 3-character pattern representing baseline, midline, and peak states:
|
|
458
466
|
|
|
459
467
|
```bash
|
|
460
|
-
|
|
468
|
+
### ASCII characters
|
|
461
469
|
prg worm --style "custom=_-=" --message "Custom ASCII"
|
|
462
470
|
|
|
463
|
-
|
|
471
|
+
### Unicode characters
|
|
464
472
|
prg worm --style "custom=β«βͺβ " --message "Custom geometric"
|
|
465
473
|
|
|
466
|
-
|
|
474
|
+
### Emojis (supports multi-byte characters)
|
|
467
475
|
prg worm --style "custom=π¦π¨π₯" --message "Color progression"
|
|
468
476
|
|
|
469
|
-
|
|
477
|
+
### Mixed ASCII and emoji
|
|
470
478
|
prg worm --style "custom=.π‘*" --message "Mixed characters"
|
|
471
479
|
```
|
|
472
480
|
|
|
@@ -538,7 +546,7 @@ The gem provides universal utilities in the `RubyProgress::Utils` module for com
|
|
|
538
546
|
```ruby
|
|
539
547
|
require 'ruby-progress'
|
|
540
548
|
|
|
541
|
-
|
|
549
|
+
### Cursor control
|
|
542
550
|
RubyProgress::Utils.hide_cursor # Hide terminal cursor
|
|
543
551
|
RubyProgress::Utils.show_cursor # Show terminal cursor
|
|
544
552
|
RubyProgress::Utils.clear_line # Clear current line
|
|
@@ -547,10 +555,10 @@ RubyProgress::Utils.clear_line # Clear current line
|
|
|
547
555
|
### Completion Messages
|
|
548
556
|
|
|
549
557
|
```ruby
|
|
550
|
-
|
|
558
|
+
### Basic completion message
|
|
551
559
|
RubyProgress::Utils.display_completion("Task completed!")
|
|
552
560
|
|
|
553
|
-
|
|
561
|
+
### With success/failure indication and checkmarks
|
|
554
562
|
RubyProgress::Utils.display_completion(
|
|
555
563
|
"Build successful!",
|
|
556
564
|
success: true,
|
|
@@ -564,7 +572,7 @@ RubyProgress::Utils.display_completion(
|
|
|
564
572
|
output_stream: :stdout # :stdout, :stderr, or :warn (default)
|
|
565
573
|
)
|
|
566
574
|
|
|
567
|
-
|
|
575
|
+
### Clear line and display completion (useful for replacing progress indicators)
|
|
568
576
|
RubyProgress::Utils.complete_with_clear(
|
|
569
577
|
"Processing complete!",
|
|
570
578
|
success: true,
|
data/Rakefile
CHANGED
|
@@ -7,6 +7,13 @@ require 'rubocop/rake_task'
|
|
|
7
7
|
RSpec::Core::RakeTask.new(:spec)
|
|
8
8
|
RuboCop::RakeTask.new
|
|
9
9
|
|
|
10
|
+
# Convenience aliases
|
|
11
|
+
# `rake test` -> runs the :spec task (RSpec)
|
|
12
|
+
task test: :spec
|
|
13
|
+
|
|
14
|
+
# Provide a `rake lint` alias that runs RuboCop (which defines the :rubocop task)
|
|
15
|
+
task lint: :rubocop
|
|
16
|
+
|
|
10
17
|
task default: [:spec]
|
|
11
18
|
|
|
12
19
|
# Used by markdown tasks
|
data/bin/fill
ADDED