gum 0.3.0-arm64-linux → 0.3.2-arm64-linux
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/README.md +12 -0
- data/exe/gum +1 -2
- data/lib/gum/command.rb +17 -12
- data/lib/gum/commands/log.rb +7 -7
- data/lib/gum/commands/spin.rb +7 -3
- data/lib/gum/version.rb +1 -1
- data/lib/gum.rb +1 -1
- data/sig/gum/command.rbs +11 -9
- data/sig/gum/commands/log.rbs +12 -12
- data/sig/gum.rbs +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89d20c2201e25ee9e0604119fb3578964a94b62767524b93d57629dcd28e38f1
|
|
4
|
+
data.tar.gz: 5b9904f81bc976687a363a2c0b11f4a6fd0c1fb4597efb7403de3751ef190e3c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d4d9b908578e89ceb3bee8551b160fe2cba5513ea989f3ea2ccd2f1d5b8b74fda489e3a3352919d57a96ea92c13a352b7f5fd986f0e7f1624bfe942e3e06532c
|
|
7
|
+
data.tar.gz: 46c6f0648d6a8d051092b59be077d5e868660201ca259f27ae78d2c81b900df67fe81ba1f4c08f3e0de94dfac5572faeef241de39ba478a74326f44a8fb06a37
|
data/README.md
CHANGED
|
@@ -458,3 +458,15 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
458
458
|
|
|
459
459
|
- [Charm](https://charm.sh/) for creating the amazing [gum](https://github.com/charmbracelet/gum) tool
|
|
460
460
|
- Inspired by [`litestream-ruby`](https://github.com/fractaledmind/litestream-ruby) for the native binary packaging approach
|
|
461
|
+
|
|
462
|
+
Charm Ruby is not affiliated with or endorsed by Charmbracelet, Inc.
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
Part of [Charm Ruby](https://charm-ruby.dev).
|
|
467
|
+
|
|
468
|
+
<a href="https://charm-ruby.dev"><img alt="Charm Ruby" src="https://marcoroth.dev/images/heros/glamorous-christmas.png" width="400"></a>
|
|
469
|
+
|
|
470
|
+
[Lipgloss](https://github.com/marcoroth/lipgloss-ruby) • [Bubble Tea](https://github.com/marcoroth/bubbletea-ruby) • [Bubbles](https://github.com/marcoroth/bubbles-ruby) • [Glamour](https://github.com/marcoroth/glamour-ruby) • [Huh?](https://github.com/marcoroth/huh-ruby) • [Harmonica](https://github.com/marcoroth/harmonica-ruby) • [Bubblezone](https://github.com/marcoroth/bubblezone-ruby) • [Gum](https://github.com/marcoroth/gum-ruby) • [ntcharts](https://github.com/marcoroth/ntcharts-ruby)
|
|
471
|
+
|
|
472
|
+
The terminal doesn't have to be boring.
|
data/exe/gum
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# Because rubygems shims assume a gem's executables are Ruby scripts,
|
|
5
5
|
# we need this wrapper to find and exec the native gum binary.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
require "bundler/setup"
|
|
9
8
|
require "gum"
|
|
10
9
|
|
|
11
10
|
exec(Gum.executable, *ARGV)
|
data/lib/gum/command.rb
CHANGED
|
@@ -7,18 +7,18 @@ require "open3"
|
|
|
7
7
|
|
|
8
8
|
module Gum
|
|
9
9
|
module Command
|
|
10
|
-
def self.run(*, input: nil, interactive: true)
|
|
11
|
-
if
|
|
12
|
-
|
|
10
|
+
def self.run(*, input: nil, interactive: true, output: :stdout)
|
|
11
|
+
if !interactive
|
|
12
|
+
run_non_interactive(*, input: input, output: output)
|
|
13
13
|
elsif input
|
|
14
|
-
|
|
14
|
+
run_interactive_with_input(*, input: input)
|
|
15
15
|
else
|
|
16
16
|
run_interactive(*)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def self.run_non_interactive(*args, input:)
|
|
21
|
-
stdout, stderr, status = Open3.capture3(Gum.executable, *args.map(&:to_s), stdin_data: input)
|
|
20
|
+
def self.run_non_interactive(*args, input:, output: :stdout)
|
|
21
|
+
stdout, stderr, status = Open3.capture3(color_env, Gum.executable, *args.map(&:to_s), stdin_data: input)
|
|
22
22
|
|
|
23
23
|
unless status.success?
|
|
24
24
|
return nil if status.exitstatus == 130 # User cancelled (Ctrl+C)
|
|
@@ -26,14 +26,14 @@ module Gum
|
|
|
26
26
|
raise Error, "gum #{args.first} failed: #{stderr}" unless stderr.empty?
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
stdout.chomp
|
|
29
|
+
(output == :stderr ? stderr : stdout).chomp
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def self.run_interactive(*args)
|
|
33
33
|
tty = File.open("/dev/tty", "r+")
|
|
34
34
|
|
|
35
35
|
stdout, wait_thread = Open3.pipeline_r(
|
|
36
|
-
[Gum.executable, *args.map(&:to_s)],
|
|
36
|
+
[color_env, Gum.executable, *args.map(&:to_s)],
|
|
37
37
|
in: tty,
|
|
38
38
|
err: tty
|
|
39
39
|
)
|
|
@@ -48,7 +48,7 @@ module Gum
|
|
|
48
48
|
|
|
49
49
|
output
|
|
50
50
|
rescue Errno::ENOENT, Errno::ENXIO, Errno::EIO
|
|
51
|
-
stdout, stderr, status = Open3.capture3(Gum.executable, *args.map(&:to_s))
|
|
51
|
+
stdout, stderr, status = Open3.capture3(color_env, Gum.executable, *args.map(&:to_s))
|
|
52
52
|
|
|
53
53
|
unless status.success?
|
|
54
54
|
return nil if status.exitstatus == 130
|
|
@@ -64,6 +64,7 @@ module Gum
|
|
|
64
64
|
stdout_read, stdout_write = IO.pipe
|
|
65
65
|
|
|
66
66
|
pid = Process.spawn(
|
|
67
|
+
color_env,
|
|
67
68
|
Gum.executable, *args.map(&:to_s),
|
|
68
69
|
in: stdin_read,
|
|
69
70
|
out: stdout_write,
|
|
@@ -91,7 +92,7 @@ module Gum
|
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
def self.run_display_only(*args, input:)
|
|
94
|
-
IO.popen([Gum.executable, *args.map(&:to_s)], "w") do |io|
|
|
95
|
+
IO.popen([color_env, Gum.executable, *args.map(&:to_s)], "w") do |io|
|
|
95
96
|
io.write(input)
|
|
96
97
|
end
|
|
97
98
|
|
|
@@ -102,10 +103,10 @@ module Gum
|
|
|
102
103
|
|
|
103
104
|
def self.run_with_status(*args, input: nil)
|
|
104
105
|
if input
|
|
105
|
-
_stdout, _stderr, status = Open3.capture3(Gum.executable, *args.map(&:to_s), stdin_data: input)
|
|
106
|
+
_stdout, _stderr, status = Open3.capture3(color_env, Gum.executable, *args.map(&:to_s), stdin_data: input)
|
|
106
107
|
status.success?
|
|
107
108
|
else
|
|
108
|
-
system(Gum.executable, *args.map(&:to_s))
|
|
109
|
+
system(color_env, Gum.executable, *args.map(&:to_s))
|
|
109
110
|
end
|
|
110
111
|
end
|
|
111
112
|
|
|
@@ -155,5 +156,9 @@ module Gum
|
|
|
155
156
|
|
|
156
157
|
negatable.fetch(command, []).include?(flag)
|
|
157
158
|
end
|
|
159
|
+
|
|
160
|
+
def self.color_env
|
|
161
|
+
$stdout.tty? ? { "CLICOLOR_FORCE" => "1" } : {}
|
|
162
|
+
end
|
|
158
163
|
end
|
|
159
164
|
end
|
data/lib/gum/commands/log.rb
CHANGED
|
@@ -30,7 +30,7 @@ module Gum
|
|
|
30
30
|
# @rbs formatter: Symbol | String | nil -- log formatter (:text, :json, :logfmt)
|
|
31
31
|
# @rbs prefix: String? -- log message prefix
|
|
32
32
|
# @rbs **fields: untyped -- additional key-value fields for structured logging
|
|
33
|
-
# @rbs return:
|
|
33
|
+
# @rbs return: bool -- true if logging succeeded
|
|
34
34
|
def self.call(
|
|
35
35
|
message,
|
|
36
36
|
level: nil,
|
|
@@ -57,40 +57,40 @@ module Gum
|
|
|
57
57
|
args << value.to_s
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
Command.
|
|
60
|
+
Command.run_with_status(*args)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# @rbs message: String -- log message text
|
|
64
64
|
# @rbs **fields: untyped -- additional key-value fields
|
|
65
|
-
# @rbs return:
|
|
65
|
+
# @rbs return: bool -- true if logging succeeded
|
|
66
66
|
def self.debug(message, **fields)
|
|
67
67
|
call(message, level: :debug, **fields)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# @rbs message: String -- log message text
|
|
71
71
|
# @rbs **fields: untyped -- additional key-value fields
|
|
72
|
-
# @rbs return:
|
|
72
|
+
# @rbs return: bool -- true if logging succeeded
|
|
73
73
|
def self.info(message, **fields)
|
|
74
74
|
call(message, level: :info, **fields)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
# @rbs message: String -- log message text
|
|
78
78
|
# @rbs **fields: untyped -- additional key-value fields
|
|
79
|
-
# @rbs return:
|
|
79
|
+
# @rbs return: bool -- true if logging succeeded
|
|
80
80
|
def self.warn(message, **fields)
|
|
81
81
|
call(message, level: :warn, **fields)
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
# @rbs message: String -- log message text
|
|
85
85
|
# @rbs **fields: untyped -- additional key-value fields
|
|
86
|
-
# @rbs return:
|
|
86
|
+
# @rbs return: bool -- true if logging succeeded
|
|
87
87
|
def self.error(message, **fields)
|
|
88
88
|
call(message, level: :error, **fields)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# @rbs message: String -- log message text
|
|
92
92
|
# @rbs **fields: untyped -- additional key-value fields
|
|
93
|
-
# @rbs return:
|
|
93
|
+
# @rbs return: bool -- true if logging succeeded
|
|
94
94
|
def self.fatal(message, **fields)
|
|
95
95
|
call(message, level: :fatal, **fields)
|
|
96
96
|
end
|
data/lib/gum/commands/spin.rb
CHANGED
|
@@ -143,9 +143,13 @@ module Gum
|
|
|
143
143
|
args << "--"
|
|
144
144
|
args.push("bash", "-c", "while [ ! -f #{marker_path} ]; do sleep 0.1; done")
|
|
145
145
|
|
|
146
|
-
spinner_pid = Process.
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
spinner_pid = Process.spawn(
|
|
147
|
+
Gum.executable, *args.map(&:to_s),
|
|
148
|
+
in: :close,
|
|
149
|
+
out: $stdout,
|
|
150
|
+
err: $stderr,
|
|
151
|
+
close_others: true
|
|
152
|
+
)
|
|
149
153
|
|
|
150
154
|
begin
|
|
151
155
|
result = block.call
|
data/lib/gum/version.rb
CHANGED
data/lib/gum.rb
CHANGED
data/sig/gum/command.rbs
CHANGED
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
module Gum
|
|
4
4
|
module Command
|
|
5
|
-
def self
|
|
5
|
+
def self.run: (*untyped, ?input: untyped, ?interactive: untyped, ?output: untyped) -> untyped
|
|
6
6
|
|
|
7
|
-
def self
|
|
7
|
+
def self.run_non_interactive: (*untyped args, input: untyped, ?output: untyped) -> untyped
|
|
8
8
|
|
|
9
|
-
def self
|
|
9
|
+
def self.run_interactive: (*untyped args) -> untyped
|
|
10
10
|
|
|
11
|
-
def self
|
|
11
|
+
def self.run_interactive_with_input: (*untyped args, input: untyped) -> untyped
|
|
12
12
|
|
|
13
|
-
def self
|
|
13
|
+
def self.run_display_only: (*untyped args, input: untyped) -> untyped
|
|
14
14
|
|
|
15
|
-
def self
|
|
15
|
+
def self.run_with_status: (*untyped args, ?input: untyped) -> untyped
|
|
16
16
|
|
|
17
|
-
def self
|
|
17
|
+
def self.build_args: (untyped command, *untyped positional, **untyped options) -> untyped
|
|
18
18
|
|
|
19
|
-
def self
|
|
19
|
+
def self.add_style_args: (untyped args, untyped flag, untyped style_hash) -> untyped
|
|
20
20
|
|
|
21
|
-
def self
|
|
21
|
+
def self.flag_supports_negation?: (untyped command, untyped flag) -> untyped
|
|
22
|
+
|
|
23
|
+
def self.color_env: () -> untyped
|
|
22
24
|
end
|
|
23
25
|
end
|
data/sig/gum/commands/log.rbs
CHANGED
|
@@ -25,32 +25,32 @@ module Gum
|
|
|
25
25
|
# @rbs formatter: Symbol | String | nil -- log formatter (:text, :json, :logfmt)
|
|
26
26
|
# @rbs prefix: String? -- log message prefix
|
|
27
27
|
# @rbs **fields: untyped -- additional key-value fields for structured logging
|
|
28
|
-
# @rbs return:
|
|
29
|
-
def self.call: (String message, ?level: Symbol | String | nil, ?time: Symbol | String | nil, ?structured: bool?, ?formatter: Symbol | String | nil, ?prefix: String?, **untyped fields) ->
|
|
28
|
+
# @rbs return: bool -- true if logging succeeded
|
|
29
|
+
def self.call: (String message, ?level: Symbol | String | nil, ?time: Symbol | String | nil, ?structured: bool?, ?formatter: Symbol | String | nil, ?prefix: String?, **untyped fields) -> bool
|
|
30
30
|
|
|
31
31
|
# @rbs message: String -- log message text
|
|
32
32
|
# @rbs **fields: untyped -- additional key-value fields
|
|
33
|
-
# @rbs return:
|
|
34
|
-
def self.debug: (String message, **untyped fields) ->
|
|
33
|
+
# @rbs return: bool -- true if logging succeeded
|
|
34
|
+
def self.debug: (String message, **untyped fields) -> bool
|
|
35
35
|
|
|
36
36
|
# @rbs message: String -- log message text
|
|
37
37
|
# @rbs **fields: untyped -- additional key-value fields
|
|
38
|
-
# @rbs return:
|
|
39
|
-
def self.info: (String message, **untyped fields) ->
|
|
38
|
+
# @rbs return: bool -- true if logging succeeded
|
|
39
|
+
def self.info: (String message, **untyped fields) -> bool
|
|
40
40
|
|
|
41
41
|
# @rbs message: String -- log message text
|
|
42
42
|
# @rbs **fields: untyped -- additional key-value fields
|
|
43
|
-
# @rbs return:
|
|
44
|
-
def self.warn: (String message, **untyped fields) ->
|
|
43
|
+
# @rbs return: bool -- true if logging succeeded
|
|
44
|
+
def self.warn: (String message, **untyped fields) -> bool
|
|
45
45
|
|
|
46
46
|
# @rbs message: String -- log message text
|
|
47
47
|
# @rbs **fields: untyped -- additional key-value fields
|
|
48
|
-
# @rbs return:
|
|
49
|
-
def self.error: (String message, **untyped fields) ->
|
|
48
|
+
# @rbs return: bool -- true if logging succeeded
|
|
49
|
+
def self.error: (String message, **untyped fields) -> bool
|
|
50
50
|
|
|
51
51
|
# @rbs message: String -- log message text
|
|
52
52
|
# @rbs **fields: untyped -- additional key-value fields
|
|
53
|
-
# @rbs return:
|
|
54
|
-
def self.fatal: (String message, **untyped fields) ->
|
|
53
|
+
# @rbs return: bool -- true if logging succeeded
|
|
54
|
+
def self.fatal: (String message, **untyped fields) -> bool
|
|
55
55
|
end
|
|
56
56
|
end
|
data/sig/gum.rbs
CHANGED
|
@@ -35,11 +35,11 @@ module Gum
|
|
|
35
35
|
|
|
36
36
|
# Choose from a list of options
|
|
37
37
|
# @see Gum::Choose#call
|
|
38
|
-
def self.choose: (
|
|
38
|
+
def self.choose: () -> untyped
|
|
39
39
|
|
|
40
40
|
# Filter items with fuzzy matching
|
|
41
41
|
# @see Gum::Filter#call
|
|
42
|
-
def self.filter: (
|
|
42
|
+
def self.filter: () -> untyped
|
|
43
43
|
|
|
44
44
|
# Prompt for confirmation
|
|
45
45
|
# @see Gum::Confirm#call
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gum
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: arm64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Marco Roth
|
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
79
|
version: '0'
|
|
80
80
|
requirements: []
|
|
81
|
-
rubygems_version:
|
|
81
|
+
rubygems_version: 4.0.3
|
|
82
82
|
specification_version: 4
|
|
83
83
|
summary: Ruby wrapper for Charm's gum CLI tool.
|
|
84
84
|
test_files: []
|