ruby-progress 1.3.4 → 1.3.6

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.
data/README.md CHANGED
@@ -2,32 +2,56 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ruby-progress.svg)](https://badge.fury.io/rb/ruby-progress)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![RSpec Tests](https://github.com/ttscoff/ruby-progress/actions/workflows/rspec.yml/badge.svg)](https://github.com/ttscoff/ruby-progress/actions/workflows/rspec.yml)
5
+ <!-- [![RSpec Tests](https://github.com/ttscoff/ruby-progress/actions/workflows/rspec.yml/badge.svg)](https://github.com/ttscoff/ruby-progress/actions/workflows/rspec.yml) -->
6
6
  [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%202.5.0-ruby.svg)](https://www.ruby-lang.org/)
7
- [![Coverage Status](https://img.shields.io/badge/coverage-55%25-yellow.svg)](#)
7
+ <!-- [![Coverage Status](https://img.shields.io/badge/coverage-31%25-yellow.svg)](#) -->
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
11
  ## Table of Contents
12
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)
13
+ - [Ruby Progress Indicators](#ruby-progress-indicators)
14
+ - [Table of Contents](#table-of-contents)
15
+ - [Unified Interface](#unified-interface)
16
+ - [Global Options](#global-options)
17
+ - [Stopping a backgrounded progress indicator](#stopping-a-backgrounded-progress-indicator)
18
+ - [Job Control Subcommands](#job-control-subcommands)
19
+ - [Example: background mode demo](#example-background-mode-demo)
20
+ - [Ripple](#ripple)
21
+ - [Ripple Features](#ripple-features)
22
+ - [Ripple Usage](#ripple-usage)
23
+ - [Ripple CLI examples](#ripple-cli-examples)
24
+ - [Ripple Command Line Options](#ripple-command-line-options)
25
+ - [Ripple Library Usage](#ripple-library-usage)
26
+ - [Twirl](#twirl)
27
+ - [Twirl Features](#twirl-features)
28
+ - [Twirl Usage](#twirl-usage)
29
+ - [Command Line](#command-line)
30
+ - [Twirl Command Line Options](#twirl-command-line-options)
31
+ - [Available Spinner Styles](#available-spinner-styles)
32
+ - [Worm](#worm)
33
+ - [Worm Features](#worm-features)
34
+ - [Worm Usage](#worm-usage)
35
+ - [Command Line](#command-line-1)
36
+ - [Daemon mode (background indicator)](#daemon-mode-background-indicator)
37
+ - [Worm Command Line Options](#worm-command-line-options)
38
+ - [Worm Library Usage](#worm-library-usage)
39
+ - [Animation Styles](#animation-styles)
40
+ - [Circles](#circles)
41
+ - [Blocks](#blocks)
42
+ - [Geometric](#geometric)
43
+ - [Custom Styles](#custom-styles)
44
+ - [Direction Control](#direction-control)
45
+ - [Requirements](#requirements)
46
+ - [Installation](#installation)
47
+ - [As a Gem (Recommended)](#as-a-gem-recommended)
48
+ - [From Source](#from-source)
49
+ - [Development](#development)
50
+ - [Universal Utilities](#universal-utilities)
51
+ - [Terminal Control](#terminal-control)
52
+ - [Completion Messages](#completion-messages)
53
+ - [Contributing](#contributing)
54
+ - [License](#license)
31
55
 
32
56
  ## Unified Interface
33
57
 
@@ -78,114 +102,86 @@ Notes:
78
102
  - The indicator clears its line on shutdown and prints the final message to STDOUT.
79
103
  - `--stop-pid` is still supported for backward compatibility, but `--stop [--pid-file FILE]` is preferred.
80
104
 
81
- ### Submitting jobs to a running daemon
105
+ ### Stopping a backgrounded progress indicator
82
106
 
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.
107
+ When running a backgrounded progress indicator (for example `prg worm --daemon`), you can send control signals using the `prg job` command with subcommands.
84
108
 
85
- Basic usage:
109
+ #### Job Control Subcommands
110
+
111
+ **Stop a running daemon:**
86
112
 
87
113
  ```bash
88
- # Enqueue a command to the default daemon PID
89
- prg job send --command "./deploy-step.sh"
114
+ # Send a stop signal to the default daemon
115
+ prg job stop
116
+
117
+ # Send a stop signal to a named daemon (uses /tmp/ruby-progress/<name>.pid)
118
+ prg job stop --daemon-name mytask
90
119
 
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"
120
+ # Send a stop signal with a completion message
121
+ prg job stop --daemon-name mytask --message "Deployment complete!"
93
122
 
94
- # Read command from stdin (useful in scripts)
95
- echo "bundle exec rake db:migrate" | prg job send --stdin --daemon-name mytask
123
+ # Send a stop signal with a checkmark
124
+ prg job stop --daemon-name mytask --message "Build successful" --checkmark
96
125
 
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
126
+ # Send a stop signal indicating an error
127
+ prg job stop --daemon-name mytask --message "Build failed" --error
99
128
  ```
100
129
 
101
- You can also send control/action jobs (no shell command) to a running daemon. These are JSON payloads with an `action` key handled by the daemon's job processor. The helper supports a few common actions:
130
+ **Check daemon status:**
102
131
 
103
132
  ```bash
104
- # Send a simple 'advance' action (no value)
105
- prg job send --daemon-name demo --advance
133
+ # Check if a daemon is running
134
+ prg job status --daemon-name mytask
106
135
 
107
- # Send a 'percent' action with a numeric value
108
- prg job send --daemon-name demo --percent 42
136
+ # Check status using a PID file
137
+ prg job status --pid-file /tmp/ruby-progress/mytask.pid
138
+ ```
109
139
 
110
- # Example using `fill` as a named daemon and sending percent updates
111
- ```bash
112
- # Start a named fill worker (non-detaching so animation remains visible)
113
- prg fill --daemon-as demo --no-detach --output-lines 3 --output-position top
140
+ **Advance a progress indicator:**
114
141
 
115
- # Send percent updates to the named worker
116
- prg job send --daemon-name demo --percent 10 --wait
117
- prg job send --daemon-name demo --percent 50 --wait
118
- prg job send --daemon-name demo --percent 100 --wait
119
- ```
142
+ ```bash
143
+ # Advance progress by 1 (for indicators that support it)
144
+ prg job advance --daemon-name mytask
120
145
 
121
- # Or use the generic action/value pair
122
- prg job send --daemon-name demo --action percent --value 42
146
+ # Advance by a specific amount
147
+ prg job advance --daemon-name mytask --amount 10
123
148
  ```
124
149
 
125
- Note about stopping named daemons:
150
+ **Backward Compatibility:**
126
151
 
127
- You can target named daemons directly using the `--stop-id NAME` shorthand which implies `--stop` and targets the named daemon (it is normalized to the canonical daemon name used for the PID file). This is convenient for scripts and demos. Example:
152
+ The legacy `prg job send` command is still supported but deprecated. It functions identically to `prg job stop`:
128
153
 
129
154
  ```bash
130
- # Stop a named fill worker with a success message
131
- prg fill --stop-id demo --stop-success 'Demo finished'
155
+ # This still works but shows a deprecation warning
156
+ prg job send --daemon-name mytask --message "Complete!"
132
157
  ```
133
158
 
134
- Behavior and file layout:
135
-
136
- - 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`.
137
- - The CLI writes the job atomically by first writing a `*.json.tmp` temporary file and then renaming it to `*.json`.
138
- - 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-*`.
139
-
140
- 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.
141
-
142
- ## Job result schema
159
+ Alternatively, you can use the built-in `--stop` flags on the progress commands:
143
160
 
144
- 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:
145
-
146
- - `id` - the job id (string)
147
- - `status` - `"done"` or `"error"`
148
- - `time` - epoch seconds when the job finished (integer)
149
-
150
- Depending on the job handler, additional keys may be present:
151
-
152
- - `exit_status` - the numeric process exit status (integer or nil if unknown)
153
- - `output` - a string with the last captured lines of output (if available)
154
- - `error` - an error message when `status` is `error`
155
-
156
- Example:
161
+ ```bash
162
+ # Stop a named daemon with a success message
163
+ prg worm --stop-id demo --stop-success 'Task completed'
157
164
 
158
- ```json
159
- {
160
- "id": "8a1f6c1e-4b7a-4f2c-b0a8-9e9f1c2f1a2b",
161
- "status": "done",
162
- "time": 1634044800,
163
- "exit_status": 0,
164
- "output": "Step 1 completed\nStep 2 completed"
165
- }
165
+ # Stop with an error message
166
+ prg worm --stop-id demo --stop-error 'Task failed'
166
167
  ```
167
168
 
168
- 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.
169
-
170
- ## Example: start a daemon and send a job (simple)
171
-
172
- Below is an example script that demonstrates starting a worm daemon, sending a job, waiting for the result, and stopping the daemon.
173
- ---
169
+ ## Example: background mode demo
174
170
 
175
- If you want the background worker to continue writing to the same terminal (so you can visually watch the animation while your script continues), use the non-detaching background mode:
171
+ Below is an example script that demonstrates starting a backgrounded progress indicator, doing work, and stopping it with a message.
176
172
 
177
173
  ```bash
178
- # Start a named worm worker that backgrounds but does not fully detach
179
- prg worm --daemon-as demo --no-detach
174
+ # Start a named worm worker that runs in the background
175
+ prg worm --daemon-as demo
180
176
 
181
- # In the same script or a subsequent command, enqueue a job to that worker
182
- prg job send --daemon-name demo --command "echo hello; sleep 1; echo done" --wait
177
+ # Do some work in your script...
178
+ sleep 2
183
179
 
184
180
  # Stop the worker with a success message
185
- prg worm --stop-id demo --stop-success "Demo finished"
181
+ prg job stop --daemon-name demo --message "Demo finished" --checkmark
186
182
  ```
187
183
 
188
- Note: Non-detaching mode keeps the child process attached to the controlling TTY. That means both the worker and the invoking shell may write to the terminal and outputs can interleave.
184
+ **Note:** Daemon mode automatically backgrounds the process using `Process.fork` and `Process.detach`, so you don't need to append `&`. The process detaches cleanly without shell job notifications.
189
185
 
190
186
  ## Ripple
191
187
 
data/bin/prg CHANGED
@@ -24,14 +24,8 @@ module PrgCLI
24
24
  # Handle `job` subcommands early
25
25
  if ARGV[0] && ARGV[0].downcase == 'job'
26
26
  ARGV.shift
27
- sub = ARGV.shift
28
- case sub
29
- when 'send'
30
- JobCLI.send(ARGV)
31
- else
32
- puts 'job subcommands: send'
33
- exit 1
34
- end
27
+ JobCLI.run(ARGV)
28
+ exit
35
29
  end
36
30
  # Early scan: detect --ends flag and validate its argument before dispatching
37
31
  if (i = ARGV.index('--ends')) && ARGV[i + 1]
@@ -151,16 +145,16 @@ module PrgCLI
151
145
  # Spawn a background child but do NOT fully detach from the controlling
152
146
  # terminal. This keeps the child attached to the same TTY so animations
153
147
  # remain visible, while the parent exits immediately allowing the caller
154
- # (shell or script) to continue. Use when the user requests a non-detaching
155
- # background worker (e.g. `--daemon-as NAME --no-detach`).
148
+ # (shell or script) to continue.
156
149
  def self.backgroundize
157
150
  pid = fork
158
- return unless pid
159
-
160
- # parent: exit so the invoking shell/script continues
161
- exit(0)
162
-
163
- # child: continue without setsid/IO close so output remains on the TTY
151
+ if pid
152
+ # Parent: detach child and exit silently
153
+ Process.detach(pid)
154
+ exit(0)
155
+ end
156
+ # Child: create new process group but keep stdin/stdout/stderr
157
+ Process.setsid
164
158
  end
165
159
 
166
160
  # Attempt to stop processes for the given subcommand. Return true if any
data/blog-post.md CHANGED
@@ -1,39 +1,154 @@
1
1
  ---
2
- title: "More CLI Progress Indicators: The ruby-progress Gem"
3
- date: 2025-10-10
2
+ title: "Ruby Progress Indicators for Modern CLI Tools"
3
+ date: 2025-10-15 11:00
4
4
  categories: [Ruby, CLI, Development Tools]
5
- tags: [ruby, cli, progress, animation, terminal]
5
+ tags: [ruby, cli, progress, animation, terminal, daemon]
6
6
  ---
7
+ I've been playing around with progress bars in the terminal, and I think I've
8
+ created something genuinely useful.
7
9
 
8
- [ripple]: https://brettterpstra.com/2025/06/30/ripple-an-indeterminate-progress-indicator/
10
+ Yes, I know there are multiple options
11
+ already available for this, but I wanted something specific: a Ruby library that
12
+ could be used for command-line scripting, with CLI executables that made it easy
13
+ to use when scripting in *any* language --- not just Ruby.
9
14
 
10
- # More CLI Progress Indicators: The ruby-progress Gem
15
+ The result is `ruby-progress`, a gem that provides four different animated
16
+ progress indicators, each with its own visual style and use cases.
11
17
 
12
- The `ruby-progress` gem expands my previous work on [Ripple], adding 2 more indicator types and a new daemon mode to make it more useful in non-Ruby shell scripts.
18
+ > If you're scripting in Ruby, I do highly recommend the TTY tools from [Piotr Murach](piotrmurach),
19
+ such as [tty-progress](https://github.com/piotrmurach/tty-progressbar/). Piotr's
20
+ TTY tools are much more elegant with a better Ruby API. `ruby-progress` is
21
+ designed more for use in other shell scripts than it is for detailed Ruby
22
+ scripting.
23
+ {:.tip}
13
24
 
14
- ## What is ruby-progress?
25
+ {% gif /uploads/2025/10/ruby-progress.mp4 %}
15
26
 
16
- Ruby-progress provides animated progress indicators for command-line applications. Unlike traditional progress bars showing completion percentage, this gem focuses on continuous animations (indeterminate) that indicate activity - perfect for tasks with unpredictable completion times.
27
+ ## The Four Progress Indicators
17
28
 
18
- Three animation styles are available:
29
+ Ripple
30
+ : creates a wave-like effect across text, with the characters rippling
31
+ through different visual states. It supports rainbow colors, inverse
32
+ highlighting, and case transformations. Perfect for text-heavy operations where
33
+ you want something more dynamic than a simple spinner.
19
34
 
20
- - **Ripple**: Wave-like effect across text
21
- - **Worm**: Moving dot pattern that crawls across the screen
22
- - **Twirl**: Classic spinning indicators with various symbols
35
+ Worm
36
+ : displays a moving dot pattern that crawls across the screen using
37
+ Unicode characters. It includes multiple styles (circles, blocks, geometric
38
+ shapes) and can move in any direction. Great for file operations, network
39
+ transfers, or any continuous background task.
23
40
 
24
- ## Quick Start
41
+ Twirl
42
+ : provides classic spinning indicators with over 35 different spinner
43
+ styles --- from simple dots to complex geometric patterns. It's the most
44
+ traditional of the four, but with way more visual variety than typical spinners.
45
+
46
+ Fill : is the only determinate indicator in the bunch --- an actual progress bar
47
+ that shows completion percentage. It can be controlled via command execution or
48
+ updated programmatically through daemon control messages.
49
+
50
+ ## Installation and Quick Start
51
+
52
+ Installation is straightforward:
25
53
 
26
54
  ```bash
27
- # Install
28
55
  gem install ruby-progress
56
+ ```
57
+
58
+ All four indicators are available through a unified `prg` command:
29
59
 
60
+ ```bash
30
61
  # Basic usage
31
- ripple "Processing files..."
32
- worm --message "Loading..." --speed fast
33
- twirl --spinner dots
62
+ prg ripple "Processing files..."
63
+ prg worm --message "Loading..." --style blocks
64
+ prg twirl --message "Working..." --style dots --speed fast
65
+ prg fill --total 100 --report
66
+
67
+ # With command execution
68
+ prg ripple "Building..." --command "make build" --success "Build complete!" --checkmark
69
+ ```
70
+
71
+ You can also use the individual commands directly: `ripple`, `worm`, `twirl`, and `fill`.
72
+
73
+ ## The Killer Feature: Daemon Mode
74
+
75
+ Here's where things get interesting. All four indicators support daemon mode,
76
+ which lets you run a progress indicator in the background while your scripts
77
+ execute other commands. This is useful for complex workflows.
78
+
79
+ ```bash
80
+ # Start a background spinner
81
+ prg worm --daemon-as deployment --message "Deploying application..."
82
+
83
+ # Execute your actual deployment steps
84
+ git push production main
85
+ kubectl apply -f manifests/
86
+ ./run-migrations.sh
87
+
88
+ # Stop the spinner with a success message
89
+ prg job stop --daemon-name deployment --message "Deployment complete!" --checkmark
90
+ ```
91
+
92
+ The daemon mode uses `Process.fork` and `Process.detach`, so there are no shell
93
+ job notifications cluttering your output. The progress indicator runs cleanly in
94
+ the background, providing visual feedback without interfering with your script's
95
+ execution.
96
+
97
+ ### Keeping Output Clean
98
+
99
+ One of the challenges with daemon mode is preventing command output from
100
+ disrupting the animation. By default, when you run a progress indicator in
101
+ daemon mode, any STDOUT or STDERR output from commands executed in your script
102
+ will appear on the terminal and potentially mess up the animation display.
103
+
104
+ Ruby-progress handles this intelligently. When running in daemon mode, the
105
+ animation continues on its dedicated line while your commands execute. However,
106
+ if you want to see the output from those commands, you have options:
107
+
108
+ ```bash
109
+ # Run command with animation, show output after completion
110
+ prg ripple "Building..." --command "make build" --stdout
111
+
112
+ # Stream output live while animation runs (reserves terminal rows)
113
+ prg worm "Installing..." --command "npm install" --stdout-live --output-lines 5
114
+
115
+ # Run daemon and manually capture output from your script commands
116
+ prg worm --daemon-as build --message "Building..."
117
+ make build > /tmp/build.log 2>&1
118
+ prg job stop --daemon-name build --message "Build complete!" --checkmark
119
+ cat /tmp/build.log
120
+ ```
121
+
122
+ The `--stdout-live` flag is particularly useful --- it reserves a section of the
123
+ terminal to display live command output while the animation continues above or
124
+ below it. You control how many lines to reserve with `--output-lines` and where
125
+ they appear with `--output-position` (above or below the animation).
126
+
127
+ ### Job Control Commands
128
+
129
+ The `prg job` command provides subcommands for controlling background indicators:
130
+
131
+ - `prg job stop` --- Stop a running daemon with an optional message
132
+ - `prg job status` --- Check if a daemon is running and show its PID
133
+ - `prg job advance` --- Update a fill progress bar by a specific amount
134
+
135
+ ```bash
136
+ # Check if a daemon is running
137
+ prg job status --daemon-name mytask
138
+
139
+ # Advance a progress bar remotely
140
+ prg fill --daemon-as progress --total 100
141
+ prg job advance --daemon-name progress --amount 10
142
+
143
+ # Stop with error state
144
+ prg job stop --daemon-name mytask --message "Build failed!" --error
34
145
  ```
35
146
 
36
- ## Ruby Integration
147
+ {% paywall "Library and advanced usage" %}
148
+
149
+ ## Ruby Library Usage
150
+
151
+ While the CLI is great for shell scripting, the Ruby API is just as elegant:
37
152
 
38
153
  ```ruby
39
154
  require 'ruby-progress'
@@ -44,131 +159,108 @@ RubyProgress::Ripple.progress("Processing files...") do
44
159
  upload_results
45
160
  end
46
161
 
47
- # Manual control
162
+ # Manual control for complex scenarios
48
163
  worm = RubyProgress::Worm.new(
49
164
  message: "Custom task",
50
165
  style: 'blocks',
51
166
  speed: 'medium'
52
167
  )
53
168
 
54
- worm.animate { heavy_computation }
55
- ```
169
+ worm.animate do
170
+ heavy_computation
171
+ more_work
172
+ end
56
173
 
57
- ## Daemon Mode - The Killer Feature
174
+ # Command execution with error handling
175
+ RubyProgress::Twirl.new(
176
+ command: "bundle install",
177
+ message: "Installing gems...",
178
+ success: "Dependencies installed!",
179
+ error: "Installation failed",
180
+ checkmark: true
181
+ ).run_with_command
182
+ ```
58
183
 
59
- Run progress indicators in the background while your scripts execute:
184
+ ## Advanced Features Worth Knowing
60
185
 
61
- ```bash
62
- # Start background indicator
63
- worm --daemon --pid-file /tmp/progress.pid --message "Deploying..."
186
+ ### Custom Styling and Icons
64
187
 
65
- # Run your actual work
66
- ./deploy.sh
67
- kubectl apply -f manifests/
188
+ All indicators support custom success and error icons:
68
189
 
69
- # Stop with success message
70
- worm --stop /tmp/progress.pid --message "Deploy complete!" --checkmark
190
+ ```bash
191
+ prg ripple "Deploying..." \
192
+ --command "./deploy.sh" \
193
+ --success "All systems go!" \
194
+ --error "Houston, we have a problem" \
195
+ --success-icon "🚀" \
196
+ --error-icon "💥" \
197
+ --checkmark
71
198
  ```
72
199
 
73
- This is incredibly useful for complex deployment scripts where you want continuous visual feedback without interrupting the main process.
74
-
75
- There's a unified binary called `prg` that takes the three types as subcommands, e.g. `prg twirl --checkmark`. You can use any of them either way.
200
+ ### Visual Customization
76
201
 
77
- ## Advanced Features
202
+ Ripple supports rainbow colors and multiple composable styles:
78
203
 
79
- ### Error Handling
80
- ```ruby
81
- RubyProgress::Ripple.progress("Risky operation") do
82
- might_fail_operation
83
- rescue StandardError => e
84
- # Automatically stops and shows error state
85
- puts "Failed: #{e.message}"
86
- end
204
+ ```bash
205
+ prg ripple "Processing" --style rainbow,inverse,caps
87
206
  ```
88
207
 
89
- ### Command Integration
90
- ```ruby
91
- # Execute shell commands with progress
92
- RubyProgress::Worm.new(
93
- command: "pg_dump mydb > backup.sql",
94
- success: "Backup complete!",
95
- error: "Backup failed"
96
- ).run_with_command
97
- ```
208
+ Worm has directional control and custom character sets:
98
209
 
99
- ### Visual Customization
100
- ```ruby
101
- # Rainbow colors and custom styling
102
- RubyProgress::Ripple.progress("Colorful task",
103
- rainbow: true,
104
- speed: :fast,
105
- format: :forward_only
106
- ) do
107
- process_with_style
108
- end
210
+ ```bash
211
+ prg worm --direction rtl --style "custom=🟦🟨🟥"
109
212
  ```
110
213
 
111
- ## Real-World Examples
214
+ ### Start/End Character Decoration
112
215
 
113
- ### Deployment Script
216
+ The `--ends` flag lets you wrap your progress indicator with decorative characters:
114
217
 
115
218
  ```bash
116
- #!/bin/bash
117
- worm --daemon-as deploy --message "Deploying..." &
219
+ prg worm --message "Magic" --ends "🎯🎪" --style blocks
220
+ prg ripple "Loading data" --ends "[]" --style rainbow
221
+ ```
118
222
 
119
- git push production main
120
- kubectl rollout status deployment/app
223
+ ### Output Capture
121
224
 
122
- worm --stop-id deploy --stop-success "Success!" --checkmark
123
- ```
225
+ When running commands, you can capture and display output:
124
226
 
125
- ### Data Processing
126
- ```ruby
127
- def import_large_csv(file)
128
- RubyProgress::Ripple.progress("Importing #{File.basename(file)}...") do
129
- CSV.foreach(file, headers: true) { |row| User.create!(row.to_h) }
130
- end
131
- end
132
- ```
227
+ ```bash
228
+ # Show command output after completion
229
+ prg ripple "Building..." --command "make build" --stdout
133
230
 
134
- ### Rake Tasks
135
- ```ruby
136
- task :backup do
137
- RubyProgress::Worm.new(
138
- command: "tar -czf backup.tar.gz app/",
139
- success: "Backup created successfully!"
140
- ).run_with_command
141
- end
231
+ # Display live output with reserved terminal rows
232
+ prg worm --command "npm install" --output-lines 5 --output-position above
142
233
  ```
234
+ {% endpaywall %}
235
+
236
+ ## Real-World Use Cases
237
+
238
+ **Deployment Scripts**: Show continuous progress during multi-step deployments
239
+ without blocking command output.
240
+
241
+ **Data Processing**: Provide visual feedback during long-running data imports or
242
+ transformations.
143
243
 
144
- ## Why ruby-progress?
244
+ **Build Systems**: Integrate into Rake or Make tasks to show progress during compilation.
145
245
 
146
- - **Simple API**: Works in Ruby code and shell scripts
147
- - **Visual Appeal**: Engaging animations beyond basic spinners
148
- - **Unique Daemon Mode**: Background progress indicators
149
- - **Production Ready**: 84.55% test coverage, 113 test examples, zero failures
150
- - **Cross-Platform**: Linux, macOS, Windows support
151
- - **Reliable**: Comprehensive error handling and edge case coverage
246
+ **CI/CD Pipelines**: Add visual indicators to pipeline scripts for better monitoring.
152
247
 
153
- ## Installation & First Steps
248
+ **System Administration**: Show progress during backups, database dumps, or file
249
+ synchronization.
154
250
 
155
- 1. **Install**: `gem install ruby-progress`
156
- 2. **Test CLI**: `ripple "Hello World!"`
157
- 3. **Try in Ruby**:
158
- ```ruby
159
- require 'ruby-progress'
160
- RubyProgress::Ripple.progress("Testing...") { sleep 2 }
161
- ```
251
+ ## Try It Out
162
252
 
163
- ## Conclusion
253
+ The easiest way to get started:
164
254
 
165
- Ruby-progress transforms boring CLI applications into engaging user experiences. Whether building deployment scripts, data processing tools, or utility commands, it provides the visual feedback users expect from modern command-line tools.
255
+ {% iterm "gem install ruby-progress" %}
166
256
 
167
- The daemon mode alone makes it worth trying - no other progress library offers this level of flexibility for complex workflows.
257
+ {% iterm "prg ripple 'Hello, World!'" %}
168
258
 
169
- **Links:**
170
- - [GitHub](https://github.com/ttscoff/ruby-progress)
171
- - [RubyGems](https://rubygems.org/gems/ruby-progress)
172
- - [Latest Release](https://github.com/ttscoff/ruby-progress/releases/latest)
259
+ Or check out the [GitHub repository](https://github.com/ttscoff/ruby-progress)
260
+ for full documentation, examples, and the complete API reference. The README
261
+ includes detailed guides for each indicator type and advanced usage patterns.
173
262
 
174
- *Make your CLI tools feel alive with ruby-progress!*
263
+ The gem is also available on
264
+ [RubyGems](https://rubygems.org/gems/ruby-progress), and the latest release
265
+ includes significant improvements to daemon mode handling and job control
266
+ commands.