clack 0.4.3 → 0.4.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 +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/clack/core/cursor.rb +1 -0
- data/lib/clack/prompts/spinner.rb +1 -0
- data/lib/clack/prompts/tasks.rb +2 -2
- data/lib/clack/version.rb +1 -1
- data/lib/clack.rb +21 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5a8d3270e58cb1ad88664e73215c2ea5217211829680707d7616714ba93c926
|
|
4
|
+
data.tar.gz: c8f58966b18a015c26b7669ebd495c0e7ba75d830088ad3135a0971dd03bc874
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3dbfd192f557ee0cd476be3ed80f54a57273e786d9120e3372c85527582ad8a30994b4202c83c309135383e6bedaaf275e756961912420961c09a24e53576e2
|
|
7
|
+
data.tar.gz: a692229800f14a3160aee3eca80f6c12b296c288e27dbf57b307b509090fdf0c72ca4e3712213f9515427ed0a48c70ee73534f85db887bb02ea1bfb9f0cf0177
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.4] - 2026-02-21
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- INT handler is now exception-safe (catches IOError/SystemCallError when output is unavailable)
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- SIGTERM handler restores cursor on graceful kill, matching INT handler behavior
|
|
10
|
+
- `Cursor.enabled?` now respects `FORCE_COLOR` environment variable, consistent with Colors module
|
|
11
|
+
- `Spinner#message` returns `self` for method chaining
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- `Task` and `TaskResult` now use `Data.define` instead of `Struct.new` (Ruby 3.2+ idiom)
|
|
15
|
+
|
|
3
16
|
## [0.4.3] - 2026-02-21
|
|
4
17
|
|
|
5
18
|
### Fixed
|
data/lib/clack/core/cursor.rb
CHANGED
data/lib/clack/prompts/tasks.rb
CHANGED
|
@@ -51,7 +51,7 @@ module Clack
|
|
|
51
51
|
# @return [Proc] the task to execute
|
|
52
52
|
# @!attribute [r] enabled
|
|
53
53
|
# @return [Boolean] whether the task should run (default: true)
|
|
54
|
-
Task =
|
|
54
|
+
Task = Data.define(:title, :task, :enabled)
|
|
55
55
|
|
|
56
56
|
# Result of a completed task, including status and any error.
|
|
57
57
|
#
|
|
@@ -61,7 +61,7 @@ module Clack
|
|
|
61
61
|
# @return [Symbol] :success or :error
|
|
62
62
|
# @!attribute [r] error
|
|
63
63
|
# @return [String, nil] error message if failed
|
|
64
|
-
TaskResult =
|
|
64
|
+
TaskResult = Data.define(:title, :status, :error)
|
|
65
65
|
|
|
66
66
|
# @param tasks [Array<Hash>] tasks with :title, :task, and optional :enabled keys
|
|
67
67
|
# @param output [IO] output stream (default: $stdout)
|
data/lib/clack/version.rb
CHANGED
data/lib/clack.rb
CHANGED
|
@@ -515,13 +515,32 @@ end
|
|
|
515
515
|
|
|
516
516
|
# Chain INT handler to restore cursor before passing to previous handler
|
|
517
517
|
previous_int_handler = trap("INT") do
|
|
518
|
-
|
|
518
|
+
begin
|
|
519
|
+
print "\e[?25h"
|
|
520
|
+
rescue IOError, SystemCallError
|
|
521
|
+
# Output unavailable — nothing we can do
|
|
522
|
+
end
|
|
519
523
|
case previous_int_handler
|
|
520
|
-
when Proc
|
|
524
|
+
when Proc
|
|
525
|
+
begin
|
|
526
|
+
previous_int_handler.call
|
|
527
|
+
rescue
|
|
528
|
+
exit(130)
|
|
529
|
+
end
|
|
521
530
|
when "DEFAULT", "SYSTEM_DEFAULT" then exit(130)
|
|
522
531
|
else exit(130)
|
|
523
532
|
end
|
|
524
533
|
end
|
|
525
534
|
|
|
535
|
+
# Handle SIGTERM similarly to INT — restore cursor on graceful kill
|
|
536
|
+
trap("TERM") do
|
|
537
|
+
begin
|
|
538
|
+
print "\e[?25h"
|
|
539
|
+
rescue IOError, SystemCallError
|
|
540
|
+
# Output unavailable
|
|
541
|
+
end
|
|
542
|
+
exit(143)
|
|
543
|
+
end
|
|
544
|
+
|
|
526
545
|
# Set up SIGWINCH handler for terminal resize
|
|
527
546
|
Clack::Core::Prompt.setup_signal_handler
|