ruby-progress 1.1.9 → 1.2.4

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
@@ -25,10 +25,25 @@ prg ripple "Loading..." --style rainbow --speed fast
25
25
  # Use twirl spinner animation
26
26
  prg twirl --message "Working..." --style dots --speed fast
27
27
 
28
- # With command execution
28
+ # Dedicated `fill` shim
29
+ # If you prefer a dedicated binary for the determinate progress bar, a thin `fill` shim is available that delegates to `prg fill`:
30
+
31
+ # Run fill directly (delegates to prg)
32
+ fill --report --percent 50
33
+ ```
34
+
35
+ ### With command execution
29
36
  prg worm --command "sleep 5" --success "Completed!" --error "Failed!" --checkmark
30
37
  prg ripple "Building..." --command "make build" --success "Build complete!" --stdout
31
38
  prg twirl --command "npm install" --message "Installing packages" --style arc
39
+
40
+ ### With start/end character decoration using --ends
41
+ prg ripple "Loading data" --ends "[]" --style rainbow
42
+ prg worm --message "Processing" --ends "()" --style blocks
43
+ prg twirl --message "Building" --ends "<<>>" --style dots
44
+
45
+ ### Complex --ends patterns with emojis
46
+ prg worm --message "Magic" --ends "🎯🎪" --style "custom=🟦🟨🟥"
32
47
  ```
33
48
 
34
49
  ### Global Options
@@ -38,7 +53,7 @@ prg twirl --command "npm install" --message "Installing packages" --style arc
38
53
  - `prg --list-styles` - Show all available styles for all subcommands
39
54
  - `prg <subcommand> --help` - Show specific subcommand help
40
55
 
41
- ### Common Options (available for both subcommands)
56
+ ### Common Options (available for all subcommands)
42
57
 
43
58
  - `--speed SPEED` - Animation speed (fast/medium/slow or f/m/s)
44
59
  - `--message MESSAGE` - Message to display
@@ -47,34 +62,35 @@ prg twirl --command "npm install" --message "Installing packages" --style arc
47
62
  - `--error MESSAGE` - Error message on failure
48
63
  - `--checkmark` - Show checkmarks (✅ success, 🛑 failure)
49
64
  - `--stdout` - Output command results to STDOUT
65
+ - `--ends CHARS` - Start/end characters (even number of chars, split in half)
50
66
 
51
67
  ### Daemon Mode (Background Progress)
52
68
 
53
69
  For shell scripts where you need a continuous progress indicator across multiple steps, use daemon mode. You can use named daemons or custom PID files.
54
70
 
55
71
  ```bash
56
- # Start in background (uses default PID file)
72
+ ### Start in background (uses default PID file)
57
73
  prg worm --daemon --message "Working..."
58
74
 
59
- # Start with a custom name (creates /tmp/ruby-progress/NAME.pid)
75
+ ### Start with a custom name (creates /tmp/ruby-progress/NAME.pid)
60
76
  prg worm --daemon-as mytask --message "Processing data..."
61
77
 
62
- # ... run your tasks ...
78
+ ### ... run your tasks ...
63
79
 
64
- # Stop with a success message and checkmark (--stop-success implies --stop)
80
+ ### Stop with a success message and checkmark (--stop-success implies --stop)
65
81
  prg worm --stop-success "All done" --stop-checkmark
66
82
 
67
- # Stop a named daemon (--stop-id implies --stop)
83
+ ### Stop a named daemon (--stop-id implies --stop)
68
84
  prg worm --stop-id mytask --stop-success "Task complete!" --stop-checkmark
69
85
 
70
- # Or stop with an error message and checkmark
86
+ ### Or stop with an error message and checkmark
71
87
  prg worm --stop-error "Failed during step" --stop-checkmark
72
88
 
73
- # Check status at any time
89
+ ### Check status at any time
74
90
  prg worm --status
75
91
  prg worm --status-id mytask
76
92
 
77
- # Use a completely custom PID file path
93
+ ### Use a completely custom PID file path
78
94
  prg worm --daemon --pid-file /tmp/custom-progress.pid
79
95
  prg worm --status --pid-file /tmp/custom-progress.pid
80
96
  prg worm --stop-success "Complete" --pid-file /tmp/custom-progress.pid
@@ -86,14 +102,67 @@ Notes:
86
102
  - `--stop-success` and `--stop-error` are mutually exclusive; whichever you provide determines the success state and icon if `--stop-checkmark` is set.
87
103
  - The indicator clears its line on shutdown and prints the final message to STDOUT.
88
104
  - `--stop-pid` is still supported for backward compatibility, but `--stop [--pid-file FILE]` is preferred.
105
+ o- [Ruby Progress Indicators](#ruby-progress-indicators)
106
+ - [Unified Interface](#unified-interface)
107
+ - [With command execution](#with-command-execution)
108
+ - [With start/end character decoration using --ends](#with-startend-character-decoration-using-ends)
109
+ - [Complex --ends patterns with emojis](#complex-ends-patterns-with-emojis)
110
+ - [Start in background (uses default PID file)](#start-in-background-uses-default-pid-file)
111
+ - [Start with a custom name (creates /tmp/ruby-progress/NAME.pid)](#start-with-a-custom-name-creates-tmpruby-progressnamepid)
112
+ - [... run your tasks ...](#-run-your-tasks-)
113
+ - [Stop with a success message and checkmark (--stop-success implies --stop)](#stop-with-a-success-message-and-checkmark-stop-success-implies-stop)
114
+ - [Stop a named daemon (--stop-id implies --stop)](#stop-a-named-daemon-stop-id-implies-stop)
115
+ - [Or stop with an error message and checkmark](#or-stop-with-an-error-message-and-checkmark)
116
+ - [Check status at any time](#check-status-at-any-time)
117
+ - [Use a completely custom PID file path](#use-a-completely-custom-pid-file-path)
118
+ - [Basic text animation](#basic-text-animation)
119
+ - [With style options](#with-style-options)
120
+ - [Multiple styles combined](#multiple-styles-combined)
121
+ - [Case transformation mode](#case-transformation-mode)
122
+ - [Run a command with progress animation](#run-a-command-with-progress-animation)
123
+ - [Simple progress block](#simple-progress-block)
124
+ - [With options](#with-options)
125
+ - [Basic spinner animation](#basic-spinner-animation)
126
+ - [With command execution](#with-command-execution)
127
+ - [Different spinner styles](#different-spinner-styles)
128
+ - [With success/error handling](#with-successerror-handling)
129
+ - [Daemon mode for background tasks](#daemon-mode-for-background-tasks)
130
+ - [... do other work ...](#-do-other-work-)
131
+ - [Run indefinitely without a command (like ripple)](#run-indefinitely-without-a-command-like-ripple)
132
+ - [Run a command with progress animation](#run-a-command-with-progress-animation)
133
+ - [Customize the animation](#customize-the-animation)
134
+ - [With custom error handling](#with-custom-error-handling)
135
+ - [With checkmarks for visual feedback](#with-checkmarks-for-visual-feedback)
136
+ - [Control animation direction (forward-only or bidirectional)](#control-animation-direction-forward-only-or-bidirectional)
137
+ - [Create custom animations with 3-character patterns](#create-custom-animations-with-3-character-patterns)
138
+ - [Add start/end characters around the animation](#add-startend-characters-around-the-animation)
139
+ - [Capture and display command output](#capture-and-display-command-output)
140
+ - [Combine checkmarks and stdout output](#combine-checkmarks-and-stdout-output)
141
+ - [Start in the background (default PID file: /tmp/ruby-progress/progress.pid)](#start-in-the-background-default-pid-file-tmpruby-progressprogresspid)
142
+ - [... run your tasks ...](#-run-your-tasks-)
143
+ - [Stop using the default PID file](#stop-using-the-default-pid-file)
144
+ - [Use a custom PID file](#use-a-custom-pid-file)
145
+ - [Stop using the matching custom PID file](#stop-using-the-matching-custom-pid-file)
146
+ - [Create and run animation with a block](#create-and-run-animation-with-a-block)
147
+ - [Your work here](#your-work-here)
148
+ - [With custom style and forward direction](#with-custom-style-and-forward-direction)
149
+ - [Or run with a command](#or-run-with-a-command)
150
+ - [ASCII characters](#ascii-characters)
151
+ - [Unicode characters](#unicode-characters)
152
+ - [Emojis (supports multi-byte characters)](#emojis-supports-multi-byte-characters)
153
+ - [Mixed ASCII and emoji](#mixed-ascii-and-emoji)
154
+ - [Cursor control](#cursor-control)
155
+ - [Basic completion message](#basic-completion-message)
156
+ - [With success/failure indication and checkmarks](#with-successfailure-indication-and-checkmarks)
157
+ - [Clear line and display completion (useful for replacing progress indicators)](#clear-line-and-display-completion-useful-for-replacing-progress-indicators)
89
158
 
90
159
  ## Table of Contents
91
160
 
92
161
  - [Ruby Progress Indicators](#ruby-progress-indicators)
93
162
  - [Unified Interface](#unified-interface)
94
- - [Global Options](#global-options)
95
- - [Common Options (available for both subcommands)](#common-options-available-for-both-subcommands)
96
- - [Daemon Mode (Background Progress)](#daemon-mode-background-progress)
163
+ - [With command execution](#with-command-execution)
164
+ - [With start/end character decoration using --ends](#with-startend-character-decoration-using---ends)
165
+ - [Complex --ends patterns with emojis](#complex---ends-patterns-with-emojis)
97
166
  - [Table of Contents](#table-of-contents)
98
167
  - [Ripple](#ripple)
99
168
  - [Ripple Features](#ripple-features)
@@ -118,6 +187,8 @@ Notes:
118
187
  - [Circles](#circles)
119
188
  - [Blocks](#blocks)
120
189
  - [Geometric](#geometric)
190
+ - [Custom Styles](#custom-styles)
191
+ - [Direction Control](#direction-control)
121
192
  - [Requirements](#requirements)
122
193
  - [Installation](#installation)
123
194
  - [As a Gem (Recommended)](#as-a-gem-recommended)
@@ -129,6 +200,7 @@ Notes:
129
200
  - [Contributing](#contributing)
130
201
  - [License](#license)
131
202
 
203
+
132
204
  ---
133
205
 
134
206
  ## Ripple
@@ -150,19 +222,19 @@ Ripple is a sophisticated text animation library that creates ripple effects acr
150
222
  #### Ripple CLI examples
151
223
 
152
224
  ```bash
153
- # Basic text animation
225
+ ### Basic text animation
154
226
  prg ripple "Loading..."
155
227
 
156
- # With style options
228
+ ### With style options
157
229
  prg ripple "Processing Data" --speed fast --style rainbow --direction bidirectional
158
230
 
159
- # Multiple styles combined
231
+ ### Multiple styles combined
160
232
  prg ripple "Loading..." --style rainbow,inverse
161
233
 
162
- # Case transformation mode
234
+ ### Case transformation mode
163
235
  prg ripple "Processing Text" --style caps,inverse
164
236
 
165
- # Run a command with progress animation
237
+ ### Run a command with progress animation
166
238
  prg ripple "Installing packages" --command "sleep 5" --success "Installation complete!" --checkmark
167
239
  ```
168
240
 
@@ -187,12 +259,12 @@ You can also use Ripple as a Ruby library:
187
259
  ```ruby
188
260
  require 'ruby-progress'
189
261
 
190
- # Simple progress block
262
+ ### Simple progress block
191
263
  result = RubyProgress::Ripple.progress("Processing...") do
192
264
  sleep 5 # Your actual work here
193
265
  end
194
266
 
195
- # With options
267
+ ### With options
196
268
  rippler = RubyProgress::Ripple.new("Loading Data", {
197
269
  speed: :fast,
198
270
  format: :bidirectional,
@@ -227,24 +299,24 @@ Twirl is a lightweight spinner animation system providing over 35 different spin
227
299
  #### Command Line
228
300
 
229
301
  ```bash
230
- # Basic spinner animation
302
+ ### Basic spinner animation
231
303
  prg twirl --message "Processing..." --style dots
232
304
 
233
- # With command execution
305
+ ### With command execution
234
306
  prg twirl --command "npm install" --message "Installing" --style arc
235
307
 
236
- # Different spinner styles
308
+ ### Different spinner styles
237
309
  prg twirl --message "Working" --style arrows --speed fast
238
310
  prg twirl --message "Loading" --style blocks --speed slow
239
311
 
240
- # With success/error handling
312
+ ### With success/error handling
241
313
  prg twirl --command "make build" --success "Build complete!" --error "Build failed!" --checkmark
242
314
 
243
- # Daemon mode for background tasks
315
+ ### Daemon mode for background tasks
244
316
  prg twirl --daemon --message "Background processing" --style geometric
245
317
  prg twirl --daemon-as mytask --message "Named task" --style dots
246
318
 
247
- # ... do other work ...
319
+ ### ... do other work ...
248
320
  prg twirl --stop-success "Processing complete!"
249
321
  prg twirl --stop-id mytask --stop-success "Task finished!"
250
322
  ```
@@ -303,26 +375,40 @@ Worm is a clean, Unicode-based progress indicator that creates a ripple effect u
303
375
  #### Command Line
304
376
 
305
377
  ```bash
306
- # Run indefinitely without a command (like ripple)
307
- ./worm.rb --message "Loading..." --speed fast --style circles
378
+ ### Run indefinitely without a command (like ripple)
379
+ prg worm --message "Loading..." --speed fast --style circles
380
+
381
+ ### Run a command with progress animation
382
+ prg worm --command "sleep 5" --message "Installing" --success "Done!"
308
383
 
309
- # Run a command with progress animation
310
- ./worm.rb --command "sleep 5" --message "Installing" --success "Done!"
384
+ ### Customize the animation
385
+ prg worm --command "make build" --speed fast --length 5 --style blocks
311
386
 
312
- # Customize the animation
313
- ./worm.rb --command "make build" --speed fast --length 5 --style blocks
387
+ ### With custom error handling
388
+ prg worm --command "risky_operation" --error "Operation failed" --style geometric
314
389
 
315
- # With custom error handling
316
- ./worm.rb --command "risky_operation" --error "Operation failed" --style geometric
390
+ ### With checkmarks for visual feedback
391
+ prg worm --command "npm install" --success "Installation complete!" --checkmark
317
392
 
318
- # With checkmarks for visual feedback
319
- ./worm.rb --command "npm install" --success "Installation complete!" --checkmark
393
+ ### Control animation direction (forward-only or bidirectional)
394
+ prg worm --message "Processing" --direction forward --style circles
395
+ prg worm --command "sleep 3" --direction bidirectional --style blocks
320
396
 
321
- # Capture and display command output
322
- ./worm.rb --command "git status" --message "Checking status" --stdout
397
+ ### Create custom animations with 3-character patterns
398
+ prg worm --message "Custom style" --style "custom=_-=" --command "sleep 2"
399
+ prg worm --message "Emoji worm!" --style "custom=🟦🟨🟥" --success "Complete!"
400
+ prg worm --message "Mixed chars" --style "custom=.🟡*" --direction forward
323
401
 
324
- # Combine checkmarks and stdout output
325
- ./worm.rb --command "echo 'Build output'" --success "Build complete!" --checkmark --stdout
402
+ ### Add start/end characters around the animation
403
+ prg worm --message "Bracketed" --ends "[]" --style circles
404
+ prg worm --message "Parentheses" --ends "()" --style blocks --direction forward
405
+ prg worm --message "Emoji ends" --ends "🎯🎪" --style "custom=🟦🟨🟥"
406
+
407
+ ### Capture and display command output
408
+ prg worm --command "git status" --message "Checking status" --stdout
409
+
410
+ ### Combine checkmarks and stdout output
411
+ prg worm --command "echo 'Build output'" --success "Build complete!" --checkmark --stdout
326
412
  ```
327
413
 
328
414
  #### Daemon mode (background indicator)
@@ -330,18 +416,18 @@ Worm is a clean, Unicode-based progress indicator that creates a ripple effect u
330
416
  Run the worm indicator as a background daemon and stop it later (useful in shell scripts):
331
417
 
332
418
  ```bash
333
- # Start in the background (default PID file: /tmp/ruby-progress/progress.pid)
419
+ ### Start in the background (default PID file: /tmp/ruby-progress/progress.pid)
334
420
  prg worm --daemon
335
421
 
336
- # ... run your tasks ...
422
+ ### ... run your tasks ...
337
423
 
338
- # Stop using the default PID file
424
+ ### Stop using the default PID file
339
425
  prg worm --stop
340
426
 
341
- # Use a custom PID file
427
+ ### Use a custom PID file
342
428
  prg worm --daemon --pid-file /tmp/custom-worm.pid
343
429
 
344
- # Stop using the matching custom PID file
430
+ ### Stop using the matching custom PID file
345
431
  prg worm --stop --pid-file /tmp/custom-worm.pid
346
432
  ```
347
433
 
@@ -351,27 +437,38 @@ Note: You don’t need `&` when starting the daemon. The command detaches itself
351
437
 
352
438
  #### Worm Command Line Options
353
439
 
354
- | Option | Description |
355
- | ----------------------- | --------------------------------------------------- |
356
- | `-s, --speed SPEED` | Animation speed (1-10, fast/medium/slow, or f/m/s) |
357
- | `-l, --length LENGTH` | Number of dots to display |
358
- | `-m, --message MESSAGE` | Message to display before animation |
359
- | `--style STYLE` | Animation style (blocks/geometric/circles or b/g/c) |
360
- | `-c, --command COMMAND` | Command to run (required) |
361
- | `--success TEXT` | Text to display on successful completion |
362
- | `--error TEXT` | Text to display on error |
440
+ | Option | Description |
441
+ | ----------------------- | ---------------------------------------------------------- |
442
+ | `-s, --speed SPEED` | Animation speed (1-10, fast/medium/slow, or f/m/s) |
443
+ | `-l, --length LENGTH` | Number of dots to display |
444
+ | `-m, --message MESSAGE` | Message to display before animation |
445
+ | `--style STYLE` | Animation style (circles/blocks/geometric or custom=XXX) |
446
+ | `--direction DIR` | Animation direction (forward/bidirectional or f/b) |
447
+ | `--ends CHARS` | Start/end characters (even number of chars, split in half) |
448
+ | `-c, --command COMMAND` | Command to run (optional) |
449
+ | `--success TEXT` | Text to display on successful completion |
450
+ | `--error TEXT` | Text to display on error |
451
+ | `--checkmark` | Show checkmarks (✅ for success, 🛑 for failure) |
452
+ | `--stdout` | Output captured command result to STDOUT |
453
+ | `--daemon` | Run in background daemon mode |
454
+ | `--daemon-as NAME` | Run in daemon mode with custom name |
455
+ | `--stop` | Stop a running daemon |
456
+ | `--stop-id NAME` | Stop daemon by name (implies --stop) |
457
+ | `--status` | Check daemon status |
458
+ | `--status-id NAME` | Check daemon status by name |
363
459
 
364
460
  ### Worm Library Usage
365
461
 
366
462
  ```ruby
367
463
  require 'ruby-progress'
368
464
 
369
- # Create and run animation with a block
465
+ ### Create and run animation with a block
370
466
  worm = RubyProgress::Worm.new(
371
467
  length: 4,
372
468
  message: "Processing",
373
469
  speed: 'fast',
374
- style: 'circles'
470
+ style: 'circles',
471
+ direction: :bidirectional
375
472
  )
376
473
 
377
474
  result = worm.animate(
@@ -382,14 +479,23 @@ result = worm.animate(
382
479
  some_long_running_task
383
480
  end
384
481
 
385
- # Or run with a command
482
+ ### With custom style and forward direction
483
+ worm = RubyProgress::Worm.new(
484
+ message: "Custom animation",
485
+ style: 'custom=🔴🟡🟢',
486
+ direction: :forward
487
+ )
488
+
489
+ result = worm.animate { sleep 3 }
490
+
491
+ ### Or run with a command
386
492
  worm = RubyProgress::Worm.new(command: "bundle install")
387
493
  worm.run_with_command
388
494
  ```
389
495
 
390
496
  ### Animation Styles
391
497
 
392
- Worm supports three built-in animation styles:
498
+ Worm supports three built-in animation styles plus custom patterns:
393
499
 
394
500
  #### Circles
395
501
 
@@ -409,6 +515,39 @@ Worm supports three built-in animation styles:
409
515
  - Midline: `▫` (small white square)
410
516
  - Peak: `■` (large black square)
411
517
 
518
+ #### Custom Styles
519
+
520
+ Create your own animation patterns using the `custom=XXX` format, where `XXX` is a 3-character pattern representing baseline, midline, and peak states:
521
+
522
+ ```bash
523
+ ### ASCII characters
524
+ prg worm --style "custom=_-=" --message "Custom ASCII"
525
+
526
+ ### Unicode characters
527
+ prg worm --style "custom=▫▪■" --message "Custom geometric"
528
+
529
+ ### Emojis (supports multi-byte characters)
530
+ prg worm --style "custom=🟦🟨🟥" --message "Color progression"
531
+
532
+ ### Mixed ASCII and emoji
533
+ prg worm --style "custom=.🟡*" --message "Mixed characters"
534
+ ```
535
+
536
+ The custom format requires exactly 3 characters and supports:
537
+ - ASCII characters
538
+ - Unicode symbols and shapes
539
+ - Emojis (properly handled as single characters)
540
+ - Mixed combinations of the above
541
+
542
+ #### Direction Control
543
+
544
+ Control the animation movement pattern:
545
+
546
+ - `--direction forward` (or `-d f`): Animation moves only forward
547
+ - `--direction bidirectional` (or `-d b`): Animation moves back and forth (default)
548
+
549
+ This works with all animation styles including custom patterns.
550
+
412
551
  ---
413
552
 
414
553
  ## Requirements
@@ -462,7 +601,7 @@ The gem provides universal utilities in the `RubyProgress::Utils` module for com
462
601
  ```ruby
463
602
  require 'ruby-progress'
464
603
 
465
- # Cursor control
604
+ ### Cursor control
466
605
  RubyProgress::Utils.hide_cursor # Hide terminal cursor
467
606
  RubyProgress::Utils.show_cursor # Show terminal cursor
468
607
  RubyProgress::Utils.clear_line # Clear current line
@@ -471,10 +610,10 @@ RubyProgress::Utils.clear_line # Clear current line
471
610
  ### Completion Messages
472
611
 
473
612
  ```ruby
474
- # Basic completion message
613
+ ### Basic completion message
475
614
  RubyProgress::Utils.display_completion("Task completed!")
476
615
 
477
- # With success/failure indication and checkmarks
616
+ ### With success/failure indication and checkmarks
478
617
  RubyProgress::Utils.display_completion(
479
618
  "Build successful!",
480
619
  success: true,
@@ -488,7 +627,7 @@ RubyProgress::Utils.display_completion(
488
627
  output_stream: :stdout # :stdout, :stderr, or :warn (default)
489
628
  )
490
629
 
491
- # Clear line and display completion (useful for replacing progress indicators)
630
+ ### Clear line and display completion (useful for replacing progress indicators)
492
631
  RubyProgress::Utils.complete_with_clear(
493
632
  "Processing complete!",
494
633
  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
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Thin shim to delegate to the unified prg CLI
5
+ prg = File.expand_path(File.join(__dir__, 'prg'))
6
+ if File.executable?(prg)
7
+ exec prg, 'fill', *ARGV
8
+ else
9
+ exec 'prg', 'fill', *ARGV
10
+ end