ruby-progress 1.3.1 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f08082d9cebd17f7d3ece436ff76e4f4beb8f934d803719a6bdc3477fa8c97b
4
- data.tar.gz: da85e2d2e2587c13f4c778094fb1dcd8e2aa832dd0cff34b947b90db0f4e6585
3
+ metadata.gz: b46930eb2d8991d939a50094820ddfd0821203a8ee1b393bbb3a1269d8c2032f
4
+ data.tar.gz: ae70d2f66ff64d6816b177a0e145d7c6ae8f6d1ee98f71cfb7198a9784493c36
5
5
  SHA512:
6
- metadata.gz: f3a816024fd6cc2aba00edd334c8b82e3783d6be3916bc36238172add46c695febcd80689ba49179b0d48a2175f983dca6b381e482c143e72f2bb0d80804b247
7
- data.tar.gz: 56fe19077105ebf00cdae2c939eb761d0b37ae4f4cb82b439207c0562ed46cd97abd9105e7b6c0789868fa6087f5d646736b3ad0a58d3df6d09e5028add6d4bf
6
+ metadata.gz: 3323def54c36c02851a2b8da4c7daca769038631ad18610f89f1e6c390449785946f61cd70a53eebc96d93b0e8da2713c228bb4078df36d8b9e3a69a6c4c4d96
7
+ data.tar.gz: 66fb49464bfe312d53110de3cceb38c8e3c64f12c7b6e1790bde8da547ee6fb726d15c77458db6409dd72efebb4982b3ac7bec97197457f3162fe4527ece7d12
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-10-09 14:47:16 UTC using RuboCop version 1.75.7.
3
+ # on 2025-10-14 13:03:02 UTC using RuboCop version 1.75.7.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -22,11 +22,11 @@ Layout/TrailingEmptyLines:
22
22
  Exclude:
23
23
  - 'test_worm_flags.rb'
24
24
 
25
- # Offense count: 4
25
+ # Offense count: 5
26
26
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
27
27
  Lint/DuplicateBranch:
28
28
  Exclude:
29
- - 'bin/prg'
29
+ - 'lib/ruby-progress/output_capture.rb'
30
30
  - 'lib/ruby-progress/utils.rb'
31
31
  - 'lib/ruby-progress/worm.rb'
32
32
 
@@ -36,6 +36,12 @@ Lint/EmptyBlock:
36
36
  Exclude:
37
37
  - 'spec/worm_integration_spec.rb'
38
38
 
39
+ # Offense count: 1
40
+ # Configuration parameters: MaximumRangeSize.
41
+ Lint/MissingCopEnableDirective:
42
+ Exclude:
43
+ - 'lib/ruby-progress/fill_cli.rb'
44
+
39
45
  # Offense count: 2
40
46
  # This cop supports safe autocorrection (--autocorrect).
41
47
  Lint/ScriptPermission:
@@ -43,63 +49,54 @@ Lint/ScriptPermission:
43
49
  - 'demo_gem.rb'
44
50
  - 'demo_worm_infinite.rb'
45
51
 
46
- # Offense count: 1
47
- Lint/SelfAssignment:
48
- Exclude:
49
- - 'lib/ruby-progress/ripple.rb'
50
-
51
- # Offense count: 1
52
- # This cop supports safe autocorrection (--autocorrect).
53
- # Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
54
- # NotImplementedExceptions: NotImplementedError
55
- Lint/UnusedMethodArgument:
56
- Exclude:
57
- - 'lib/ruby-progress/worm.rb'
58
-
59
- # Offense count: 23
52
+ # Offense count: 22
60
53
  # This cop supports safe autocorrection (--autocorrect).
61
54
  # Configuration parameters: AutoCorrect.
62
55
  Lint/UselessAssignment:
63
56
  Exclude:
64
57
  - 'demo_gem.rb'
65
- - 'lib/ruby-progress/worm.rb'
66
58
  - 'spec/cli_integration_spec.rb'
67
59
 
68
- # Offense count: 20
60
+ # Offense count: 50
69
61
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
70
62
  Metrics/AbcSize:
71
- Max: 114
63
+ Max: 121
72
64
 
73
- # Offense count: 17
65
+ # Offense count: 52
74
66
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
75
67
  # AllowedMethods: refine
76
68
  Metrics/BlockLength:
77
- Max: 109
69
+ Max: 111
78
70
 
79
- # Offense count: 2
71
+ # Offense count: 5
80
72
  # Configuration parameters: CountComments, CountAsOne.
81
73
  Metrics/ClassLength:
82
- Max: 254
74
+ Max: 200
83
75
 
84
- # Offense count: 12
76
+ # Offense count: 33
85
77
  # Configuration parameters: AllowedMethods, AllowedPatterns.
86
78
  Metrics/CyclomaticComplexity:
87
- Max: 19
79
+ Max: 26
88
80
 
89
- # Offense count: 31
81
+ # Offense count: 70
90
82
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
91
83
  Metrics/MethodLength:
92
- Max: 131
84
+ Max: 140
93
85
 
94
- # Offense count: 3
86
+ # Offense count: 10
95
87
  # Configuration parameters: CountComments, CountAsOne.
96
88
  Metrics/ModuleLength:
97
- Max: 206
89
+ Max: 287
98
90
 
99
- # Offense count: 10
91
+ # Offense count: 1
92
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
93
+ Metrics/ParameterLists:
94
+ Max: 6
95
+
96
+ # Offense count: 32
100
97
  # Configuration parameters: AllowedMethods, AllowedPatterns.
101
98
  Metrics/PerceivedComplexity:
102
- Max: 20
99
+ Max: 27
103
100
 
104
101
  # Offense count: 1
105
102
  # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
@@ -110,7 +107,7 @@ Naming/FileName:
110
107
  - 'Rakefile.rb'
111
108
  - 'lib/ruby-progress.rb'
112
109
 
113
- # Offense count: 17
110
+ # Offense count: 10
114
111
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
115
112
  # SupportedStyles: snake_case, normalcase, non_integer
116
113
  # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
@@ -127,15 +124,6 @@ Style/Documentation:
127
124
  - 'lib/ruby-progress.rb'
128
125
  - 'lib/ruby-progress/daemon.rb'
129
126
 
130
- # Offense count: 4
131
- # This cop supports unsafe autocorrection (--autocorrect-all).
132
- # Configuration parameters: EnforcedStyle.
133
- # SupportedStyles: allowed_in_returns, forbidden
134
- Style/DoubleNegation:
135
- Exclude:
136
- - 'bin/prg'
137
- - 'lib/ruby-progress/worm.rb'
138
-
139
127
  # Offense count: 1
140
128
  # This cop supports safe autocorrection (--autocorrect).
141
129
  # Configuration parameters: AutoCorrect, EnforcedStyle, AllowComments.
@@ -167,14 +155,13 @@ Style/InfiniteLoop:
167
155
  Exclude:
168
156
  - 'lib/ruby-progress/ripple.rb'
169
157
 
170
- # Offense count: 2
158
+ # Offense count: 1
171
159
  # This cop supports unsafe autocorrection (--autocorrect-all).
172
160
  # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
173
161
  # SupportedStyles: predicate, comparison
174
162
  Style/NumericPredicate:
175
163
  Exclude:
176
164
  - 'spec/**/*'
177
- - 'bin/prg'
178
165
  - 'lib/ruby-progress/ripple.rb'
179
166
 
180
167
  # Offense count: 1
@@ -193,7 +180,7 @@ Style/StringLiterals:
193
180
  Exclude:
194
181
  - 'test_worm_flags.rb'
195
182
 
196
- # Offense count: 3
183
+ # Offense count: 46
197
184
  # This cop supports safe autocorrection (--autocorrect).
198
185
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
199
186
  # URISchemes: http, https
data/CHANGELOG.md CHANGED
@@ -27,153 +27,124 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
27
27
 
28
28
  - Merge commit: 99d9c39 (squash-merge of feature/output-handling)
29
29
 
30
- ## 1.3.1 - 2025-10-12
30
+ ## Unreleased
31
31
 
32
- ### Added
32
+ ### Fixed
33
33
 
34
- - `fill` subcommand: added `-c, --command COMMAND` so the determinate progress bar can run and capture command output like the other subcommands. This includes `--output-lines` and `--output-position` support for reserving terminal rows during capture.
34
+ - Output capture: ensure `--output-lines N` is honored when reserving terminal rows for captured output; coerce the `lines` option to an integer and stabilize the reserve/redraw logic so live captured output does not overwrite the prompt or animation.
35
35
 
36
36
  ### Changed
37
37
 
38
- - Bumped `FILL_VERSION` (patch) to reflect the new CLI behavior.
39
-
38
+ - Prepared for next patch release.
40
39
 
41
- ## 1.2.3 - 2025-10-11
40
+ ## 1.3.3 - 2025-10-14
42
41
 
43
- ### Added
42
+ ### Fixed
44
43
 
45
- - Dedicated `fill` shim: added `bin/fill` that delegates to `prg fill`.
44
+ - Output capture: ensure `--output-lines N` is honored when reserving terminal rows for captured output; coerce the `lines` option to an integer and stabilize the reserve/redraw logic so live captured output does not overwrite the prompt or animation.
46
45
 
47
46
  ### Changed
48
47
 
49
- - Version bumps: prg 1.2.2 1.2.3, fill 1.0.0 → 1.0.1
48
+ - Removed one-off init trace writes and cleaned debug logging. Bumped main gem `VERSION` to 1.3.3 during intermediate fixes.
50
49
 
51
- ## 1.2.2 - 2025-10-11
50
+ ## 1.3.2 - 2025-10-13
52
51
 
53
- ### Improved
52
+ ### Added
54
53
 
55
- - Demo script enhancements: updated quick demo with better visual examples.
54
+ - `fill` subcommand: added `-c, --command COMMAND` so the determinate progress bar can run and capture command output like the other subcommands. This includes `--output-lines` and `--output-position` support for reserving terminal rows during capture.
56
55
 
57
- ### Technical
56
+ ### Changed
58
57
 
59
- - Version alignment: synchronized demo script version display with actual gem version.
58
+ - Added `--stop-id NAME` shorthand for targeting named daemons (implies `--stop` and normalizes the name to the canonical PID filename). This is a small convenience used by the demo and scripts.
59
+ - Demo: updated `demo_screencast.rb` to call the local `bin/prg` when stopping the demo daemon to avoid conflicts with system-installed versions.
60
60
 
61
- ## 1.2.4 - 2025-10-12
61
+ # CHANGELOG
62
62
 
63
- ### Added
63
+ All notable changes to this project will be documented in this file.
64
+
65
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67
+
68
+ ## Unreleased
64
69
 
65
- - Small bug fixes and test stability improvements:
66
- - Ensured SimpleCov finalization runs reliably across Ruby versions during tests.
67
- - Minor CLI help text clarifications and version constant alignment.
70
+ ### Fixed
71
+
72
+ - Output capture: ensure `--output-lines N` is honored when reserving terminal rows for captured output; coerce the `lines` option to an integer and stabilize the reserve/redraw logic so live captured output does not overwrite the prompt or animation.
68
73
 
69
74
  ### Changed
70
75
 
71
- - Bumped gem version and synchronized component version constants where applicable.
72
- - Messages now display cleanly at the beginning of a new line
73
- - Affects all three commands: ripple, worm, and twirl
74
- - Resolves issue where completion messages appeared mid-line after animation ended
75
- - Improved professional appearance of CLI output
76
+ - Prepared for next patch release.
76
77
 
77
- Technical
78
+ ## 1.3.4 - 2025-10-14
78
79
 
79
- - **Enhanced display_completion method**: Added proper line clearing and cursor positioning
80
- - Uses `re[2K` sequence followed by clean message display
81
- - Updated test expectations to match new output format
82
- - Maintains backward compatibility with existing functionality
80
+ ### Fixed
83
81
 
84
- ## 1.2.0 - 2025-10-11
82
+ - Ensure non-live (`--stdout`) capture does not stream output to the terminal during animation; captured output is now emitted at completion only.
83
+ - Stabilized PTY-based output capture redraw/reserve logic and cursor save/restore fallback.
85
84
 
86
- ### Added
85
+ ### Changed
86
+
87
+ - Bumped main gem `VERSION` to 1.3.4.
88
+ - Cleaned up one-off debug/init traces written during development.
87
89
 
88
- - **--ends flag for all commands**: New universal option to add start/end characters around animations
89
- - Accepts even-length strings split in half for start and end characters
90
- - Works across all three commands: ripple, worm, and twirl
91
- - Examples: `--ends "[]"` → `[animation]`, `--ends "<<>>"` → `<<animation>>`
92
- - Multi-byte character support for emojis: `--ends "🎯🎪"` → `🎯animation🎪`
93
- - Graceful fallback for invalid input (odd-length strings)
94
-
95
- - **Comprehensive test coverage for new features**: Added extensive test suites
96
- - Direction control tests: Forward-only vs bidirectional animation behavior
97
- - Custom style tests: ASCII, Unicode, emoji, and mixed character pattern validation
98
- - CLI integration tests: End-to-end testing for all new command-line options
99
- - Ends functionality tests: Multi-byte character handling, error cases, help documentation
100
- - Total: 58 new test examples covering all edge cases
101
-
102
- - **Worm direction control**: Fine-grained animation movement control
103
- - `--direction forward` (or `-d f`): Animation moves only forward, resets at end
104
- - `--direction bidirectional` (or `-d b`): Default back-and-forth movement
105
- - Compatible with all worm styles including custom patterns
106
-
107
- - **Worm custom styles**: User-defined 3-character animation patterns
108
- - Format: `--style custom=abc` where `abc` defines baseline, midline, peak characters
109
- - ASCII support: `--style custom=_-=` → `___-=___`
110
- - Unicode support: `--style custom=▫▪■` → geometric patterns
111
- - Emoji support: `--style custom=🟦🟨🟥` → colorful animations
112
- - Mixed characters: `--style custom=.🟡*` → combined ASCII and emoji
113
- - Proper multi-byte character counting for accurate 3-character validation
114
- - **Ripple style flags**: `--spinner`, `--rainbow`, `--inverse`, and `--caps` flags deprecated in favor of unified `--style` system (backward
115
- compatibility maintained)
90
+ ## 1.3.3 - 2025-10-14
116
91
 
117
92
  ### Fixed
118
93
 
119
- - **OptionParser conflicts**: Resolved parsing issues with optional arguments that could consume following flags
120
- - **Daemon workflow**: Streamlined daemon start/stop workflow eliminating need for redundant flag combinations
94
+ - Output capture: ensure `--output-lines N` is honored when reserving terminal rows for captured output; coerce the `lines` option to an integer and stabilize the reserve/redraw logic so live captured output does not overwrite the prompt or animation.
121
95
 
122
- ## 1.0.1 - 2025-01-01
96
+ ### Changed
123
97
 
124
- ## 1.1.0 - 2025-10-09
98
+ - Removed one-off init trace writes and cleaned debug logging.
99
+
100
+ ## 1.3.2 - 2025-10-13
125
101
 
126
102
  ### Added
127
103
 
128
- - Shared daemon helpers module `RubyProgress::Daemon` for default PID file, control message file, status, and stop logic
129
- - Unified daemon flags across ripple and worm: `--daemon`, `--status`, `--stop`, `--pid-file`, `--stop-success`, `--stop-error`,
130
- `--stop-checkmark`
131
- - Ripple: daemon parity with worm, including clean shutdown on SIGUSR1/TERM/HUP/INT
104
+ - `fill` subcommand: added `-c, --command COMMAND` so the determinate progress bar can run and capture command output like the other subcommands. This includes `--output-lines` and `--output-position` support for reserving terminal rows during capture.
132
105
 
133
106
  ### Changed
134
107
 
135
- - `bin/prg` now delegates status/stop/default PID handling to `RubyProgress::Daemon`
136
- - README updated with new daemon usage examples and flag descriptions
108
+ - Added `--stop-id NAME` shorthand for targeting named daemons (implies `--stop` and normalizes the name to the canonical PID filename). This is a small convenience used by the demo and scripts.
109
+ - Demo: updated `demo_screencast.rb` to call the local `bin/prg` when stopping the demo daemon to avoid conflicts with system-installed versions.
110
+
111
+ ## 1.2.4 - 2025-10-12
112
+
113
+ ### Added
137
114
 
138
- Deprecated
115
+ - Small bug fixes and test stability improvements; ensured SimpleCov finalization runs reliably across Ruby versions during tests and minor CLI help clarifications.
139
116
 
140
- - `--stop-pid` remains available but is deprecated in favor of `--stop [--pid-file FILE]`
117
+ ## 1.2.3 - 2025-10-11
141
118
 
142
119
  ### Added
143
120
 
144
- - Packaged as proper Ruby gem with library structure
145
- - Added RSpec test suite with comprehensive coverage
146
- - Added Rake tasks for version management and packaging
147
- - Added --checkmark and --stdout flags to Worm (ported from Ripple)
148
- - Added infinite mode to Worm (runs indefinitely without command like Ripple)
149
- - **Added unified `prg` binary with subcommands for both `ripple` and `worm`**
150
- - **Enhanced command-line interface with consistent flag support across both tools**
151
- - **Added `RubyProgress::Utils` module with universal terminal control utilities**
152
- - **Centralized cursor control, line clearing, and completion message functionality**
153
- - **Added daemon mode for background progress indicators in bash scripts**
154
- - **Implemented signal-based control (SIGUSR1) for clean daemon shutdown**
121
+ - Dedicated `fill` shim: added `bin/fill` that delegates to `prg fill`.
155
122
 
156
- ### Changed
123
+ ## 1.2.2 - 2025-10-11
124
+
125
+ ### Improved
157
126
 
158
- - Moved classes into RubyProgress module
159
- - Separated logic into lib/ruby-progress/ structure
160
- - Created proper bin/ executables for ripple and worm
161
- - Updated README with gem installation and usage instructions
127
+ - Demo script enhancements: updated quick demo with better visual examples.
162
128
 
163
- ### Fixed
129
+ ## 1.2.0 - 2025-10-11
130
+
131
+ ### Added
132
+
133
+ - `--ends` flag for all commands and lots of smaller UX and testing improvements.
164
134
 
165
- - Fixed duplicate error messages in Worm error handling
166
- - Improved signal handling and cursor management
135
+ ## 1.1.0 - 2025-10-09
136
+
137
+ ### Added
138
+
139
+ - Shared daemon helpers module `RubyProgress::Daemon` and unified daemon flags across ripple and worm.
167
140
 
168
141
  ## 1.0.0 - 2025-10-09
169
142
 
170
143
  ### Added
171
144
 
172
- - Initial release with two progress indicators:
173
- - Ripple: Text ripple animation with 30+ spinner styles, rainbow effects, and command execution
174
- - Worm: Unicode wave animation with multiple styles and configurable options
175
- - Command-line interfaces for both tools
176
- - Support for custom speeds, messages, and styling options
177
- - Integration with system commands and process monitoring
145
+ - Initial release with two progress indicators (Ripple and Worm) and basic CLI tooling.
146
+
147
+
148
+ ## 1.0.1 - 2025-01-01
178
149
 
179
150
 
data/Gemfile CHANGED
@@ -10,4 +10,6 @@ group :development, :test do
10
10
  gem 'rspec', '~> 3.0'
11
11
  gem 'rubocop', '~> 1.21'
12
12
  gem 'simplecov', '~> 0.21', require: false
13
+ gem 'tty-cursor', '~> 0.7'
14
+ gem 'tty-screen', '~> 0.8'
13
15
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-progress (1.3.1)
4
+ ruby-progress (1.3.4)
5
+ tty-cursor (~> 0.7)
6
+ tty-screen (~> 0.8)
5
7
 
6
8
  GEM
7
9
  remote: https://rubygems.org/
@@ -55,6 +57,8 @@ GEM
55
57
  simplecov_json_formatter (~> 0.1)
56
58
  simplecov-html (0.13.1)
57
59
  simplecov_json_formatter (0.1.4)
60
+ tty-cursor (0.7.1)
61
+ tty-screen (0.8.2)
58
62
  unicode-display_width (3.1.4)
59
63
  unicode-emoji (~> 4.0, >= 4.0.4)
60
64
  unicode-emoji (4.0.4)
@@ -69,6 +73,8 @@ DEPENDENCIES
69
73
  rubocop (~> 1.21)
70
74
  ruby-progress!
71
75
  simplecov (~> 0.21)
76
+ tty-cursor (~> 0.7)
77
+ tty-screen (~> 0.8)
72
78
 
73
79
  BUNDLED WITH
74
80
  2.6.8
data/README.md CHANGED
@@ -98,6 +98,39 @@ echo "bundle exec rake db:migrate" | prg job send --stdin --daemon-name mytask
98
98
  prg job send --daemon-name mytask --command "./deploy-step.sh" --wait --timeout 30
99
99
  ```
100
100
 
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:
102
+
103
+ ```bash
104
+ # Send a simple 'advance' action (no value)
105
+ prg job send --daemon-name demo --advance
106
+
107
+ # Send a 'percent' action with a numeric value
108
+ prg job send --daemon-name demo --percent 42
109
+
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
114
+
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
+ ```
120
+
121
+ # Or use the generic action/value pair
122
+ prg job send --daemon-name demo --action percent --value 42
123
+ ```
124
+
125
+ Note about stopping named daemons:
126
+
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:
128
+
129
+ ```bash
130
+ # Stop a named fill worker with a success message
131
+ prg fill --stop-id demo --stop-success 'Demo finished'
132
+ ```
133
+
101
134
  Behavior and file layout:
102
135
 
103
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`.
@@ -139,6 +172,21 @@ This file is intended for short messages and small captured output snippets (the
139
172
  Below is an example script that demonstrates starting a worm daemon, sending a job, waiting for the result, and stopping the daemon.
140
173
  ---
141
174
 
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:
176
+
177
+ ```bash
178
+ # Start a named worm worker that backgrounds but does not fully detach
179
+ prg worm --daemon-as demo --no-detach
180
+
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
183
+
184
+ # Stop the worker with a success message
185
+ prg worm --stop-id demo --stop-success "Demo finished"
186
+ ```
187
+
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.
189
+
142
190
  ## Ripple
143
191
 
144
192
  Ripple is a sophisticated text animation library that creates ripple effects across text strings in the terminal. It supports various animation modes including bidirectional movement, and rainbow colors.
data/Rakefile CHANGED
@@ -108,7 +108,6 @@ namespace :markdown do
108
108
  !!(line =~ /^\s*```|^\s*~~~/)
109
109
  end
110
110
 
111
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
112
111
  def format_markdown(content)
113
112
  lines = content.split("\n", -1)
114
113
  out = []
@@ -167,8 +166,6 @@ namespace :markdown do
167
166
  out << '' if (last = out.last) && !last.empty?
168
167
  out.join("\n")
169
168
  end
170
- # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
171
-
172
169
  desc 'Lint markdown (reports files that would be changed)'
173
170
  task :lint do
174
171
  changed = []
data/bin/prg CHANGED
@@ -148,6 +148,21 @@ module PrgCLI
148
148
  end
149
149
  end
150
150
 
151
+ # Spawn a background child but do NOT fully detach from the controlling
152
+ # terminal. This keeps the child attached to the same TTY so animations
153
+ # 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`).
156
+ def self.backgroundize
157
+ 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
164
+ end
165
+
151
166
  # Attempt to stop processes for the given subcommand. Return true if any
152
167
  # process was signaled/stopped; false otherwise. Keep quiet on missing
153
168
  # processes to satisfy integration tests.