gum 0.3.1-arm64-darwin → 0.3.2-arm64-darwin
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/exe/gum +1 -2
- data/lib/gum/command.rb +15 -10
- data/lib/gum/commands/log.rb +7 -7
- data/lib/gum/version.rb +1 -1
- data/lib/gum.rb +1 -1
- data/sig/gum/command.rbs +4 -2
- data/sig/gum/commands/log.rbs +12 -12
- data/sig/gum.rbs +2 -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: '0501598cd6d46cffa2d6d0c6b6ab58f98eef51ad1d7bb2b2f4b81fa789946cdb'
|
|
4
|
+
data.tar.gz: 384fb147853fea0f295495d637d46ebf0c885ba9153478505de2046a29dfebe4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33f806c016e2fe0f2ca532f1002be3fa052acf7ea1092a9a14da879446ca92e47fcc7fb1f7de16e3860b14c6c0cf1002b2758ca3c964779db982b701fd6f90db
|
|
7
|
+
data.tar.gz: '0948394630b5716a504d1e7b6dde203ffacad06f58e4e57c5c48cca0cc0b99da99bf0ce524d1c1c43139ee5ffe31565b54e7e3f0384dc8bf64dc29d3aeb94672'
|
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,9 +7,9 @@ require "open3"
|
|
|
7
7
|
|
|
8
8
|
module Gum
|
|
9
9
|
module Command
|
|
10
|
-
def self.run(*, input: nil, interactive: true)
|
|
10
|
+
def self.run(*, input: nil, interactive: true, output: :stdout)
|
|
11
11
|
if !interactive
|
|
12
|
-
run_non_interactive(*, input: input)
|
|
12
|
+
run_non_interactive(*, input: input, output: output)
|
|
13
13
|
elsif input
|
|
14
14
|
run_interactive_with_input(*, input: input)
|
|
15
15
|
else
|
|
@@ -17,8 +17,8 @@ module Gum
|
|
|
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/version.rb
CHANGED
data/lib/gum.rb
CHANGED
data/sig/gum/command.rbs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Gum
|
|
4
4
|
module Command
|
|
5
|
-
def self.run: (*untyped, ?input: untyped, ?interactive: untyped) -> untyped
|
|
5
|
+
def self.run: (*untyped, ?input: untyped, ?interactive: untyped, ?output: untyped) -> untyped
|
|
6
6
|
|
|
7
|
-
def self.run_non_interactive: (*untyped args, input: untyped) -> untyped
|
|
7
|
+
def self.run_non_interactive: (*untyped args, input: untyped, ?output: untyped) -> untyped
|
|
8
8
|
|
|
9
9
|
def self.run_interactive: (*untyped args) -> untyped
|
|
10
10
|
|
|
@@ -19,5 +19,7 @@ module Gum
|
|
|
19
19
|
def self.add_style_args: (untyped args, untyped flag, untyped style_hash) -> untyped
|
|
20
20
|
|
|
21
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
|