roast-ai 0.4.10 → 0.5.1
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/.claude/commands/docs/write-comments.md +36 -0
- data/.github/CODEOWNERS +1 -1
- data/.github/workflows/ci.yaml +10 -6
- data/.gitignore +0 -1
- data/.rubocop.yml +7 -1
- data/.ruby-version +1 -1
- data/CLAUDE.md +2 -2
- data/CONTRIBUTING.md +2 -0
- data/Gemfile +19 -18
- data/Gemfile.lock +35 -58
- data/README.md +118 -1432
- data/README_LEGACY.md +1464 -0
- data/Rakefile +39 -4
- data/dev.yml +29 -0
- data/dsl/agent_sessions.rb +20 -0
- data/dsl/async_cogs.rb +49 -0
- data/dsl/async_cogs_complex.rb +67 -0
- data/dsl/call.rb +44 -0
- data/dsl/collect_from.rb +72 -0
- data/dsl/json_output.rb +28 -0
- data/dsl/map.rb +55 -0
- data/dsl/map_reduce.rb +37 -0
- data/dsl/map_with_index.rb +49 -0
- data/dsl/next_break.rb +45 -0
- data/dsl/next_break_parallel.rb +44 -0
- data/dsl/outputs.rb +39 -0
- data/dsl/outputs_bang.rb +36 -0
- data/dsl/parallel_map.rb +37 -0
- data/dsl/prompts/simple_prompt.md.erb +3 -0
- data/dsl/prototype.rb +5 -7
- data/dsl/repeat_loop_results.rb +53 -0
- data/dsl/ruby_cog.rb +72 -0
- data/dsl/simple_agent.rb +18 -0
- data/dsl/simple_chat.rb +15 -1
- data/dsl/simple_repeat.rb +29 -0
- data/dsl/skip.rb +36 -0
- data/dsl/step_communication.rb +2 -3
- data/dsl/targets_and_params.rb +57 -0
- data/dsl/temperature.rb +17 -0
- data/dsl/temporary_directory.rb +22 -0
- data/dsl/tutorial/01_your_first_workflow/README.md +179 -0
- data/dsl/tutorial/01_your_first_workflow/configured_chat.rb +33 -0
- data/dsl/tutorial/01_your_first_workflow/hello.rb +23 -0
- data/dsl/tutorial/02_chaining_cogs/README.md +310 -0
- data/dsl/tutorial/02_chaining_cogs/code_review.rb +104 -0
- data/dsl/tutorial/02_chaining_cogs/session_resumption.rb +92 -0
- data/dsl/tutorial/02_chaining_cogs/simple_chain.rb +84 -0
- data/dsl/tutorial/03_targets_and_params/README.md +230 -0
- data/dsl/tutorial/03_targets_and_params/multiple_targets.rb +65 -0
- data/dsl/tutorial/03_targets_and_params/single_target.rb +65 -0
- data/dsl/tutorial/04_configuration_options/README.md +209 -0
- data/dsl/tutorial/04_configuration_options/control_display_and_temperature.rb +104 -0
- data/dsl/tutorial/04_configuration_options/simple_config.rb +68 -0
- data/dsl/tutorial/05_control_flow/README.md +156 -0
- data/dsl/tutorial/05_control_flow/conditional_execution.rb +62 -0
- data/dsl/tutorial/05_control_flow/handling_failures.rb +77 -0
- data/dsl/tutorial/06_reusable_scopes/README.md +172 -0
- data/dsl/tutorial/06_reusable_scopes/accessing_scope_outputs.rb +126 -0
- data/dsl/tutorial/06_reusable_scopes/basic_scope.rb +63 -0
- data/dsl/tutorial/06_reusable_scopes/parameterized_scope.rb +78 -0
- data/dsl/tutorial/07_processing_collections/README.md +152 -0
- data/dsl/tutorial/07_processing_collections/basic_map.rb +70 -0
- data/dsl/tutorial/07_processing_collections/parallel_map.rb +74 -0
- data/dsl/tutorial/08_iterative_workflows/README.md +231 -0
- data/dsl/tutorial/08_iterative_workflows/basic_repeat.rb +57 -0
- data/dsl/tutorial/08_iterative_workflows/conditional_break.rb +57 -0
- data/dsl/tutorial/09_async_cogs/README.md +197 -0
- data/dsl/tutorial/09_async_cogs/basic_async.rb +38 -0
- data/dsl/tutorial/README.md +222 -0
- data/dsl/working_directory.rb +16 -0
- data/exe/roast +1 -1
- data/internal/documentation/architectural-notes.md +115 -0
- data/internal/documentation/doc-comments-external.md +686 -0
- data/internal/documentation/doc-comments-internal.md +342 -0
- data/internal/documentation/doc-comments.md +211 -0
- data/lib/roast/dsl/cog/config.rb +274 -3
- data/lib/roast/dsl/cog/input.rb +53 -10
- data/lib/roast/dsl/cog/output.rb +297 -8
- data/lib/roast/dsl/cog/registry.rb +35 -3
- data/lib/roast/dsl/cog/stack.rb +1 -1
- data/lib/roast/dsl/cog/store.rb +5 -5
- data/lib/roast/dsl/cog.rb +70 -14
- data/lib/roast/dsl/cog_input_context.rb +36 -1
- data/lib/roast/dsl/cog_input_manager.rb +116 -7
- data/lib/roast/dsl/cogs/agent/config.rb +465 -0
- data/lib/roast/dsl/cogs/agent/input.rb +81 -0
- data/lib/roast/dsl/cogs/agent/output.rb +59 -0
- data/lib/roast/dsl/cogs/agent/provider.rb +51 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/claude_invocation.rb +185 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/message.rb +73 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/assistant_message.rb +36 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/result_message.rb +61 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/system_message.rb +47 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/text_message.rb +36 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_result_message.rb +47 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_use_message.rb +46 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/unknown_message.rb +27 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/user_message.rb +37 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/tool_result.rb +51 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/tool_use.rb +48 -0
- data/lib/roast/dsl/cogs/agent/providers/claude.rb +31 -0
- data/lib/roast/dsl/cogs/agent/stats.rb +92 -0
- data/lib/roast/dsl/cogs/agent/usage.rb +62 -0
- data/lib/roast/dsl/cogs/agent.rb +75 -0
- data/lib/roast/dsl/cogs/chat/config.rb +453 -0
- data/lib/roast/dsl/cogs/chat/input.rb +92 -0
- data/lib/roast/dsl/cogs/chat/output.rb +64 -0
- data/lib/roast/dsl/cogs/chat/session.rb +68 -0
- data/lib/roast/dsl/cogs/chat.rb +59 -56
- data/lib/roast/dsl/cogs/cmd.rb +251 -61
- data/lib/roast/dsl/cogs/ruby.rb +171 -0
- data/lib/roast/dsl/command_runner.rb +191 -0
- data/lib/roast/dsl/config_manager.rb +58 -11
- data/lib/roast/dsl/control_flow.rb +41 -0
- data/lib/roast/dsl/execution_manager.rb +162 -32
- data/lib/roast/dsl/nil_assertions.rb +23 -0
- data/lib/roast/dsl/system_cog/params.rb +32 -0
- data/lib/roast/dsl/system_cog.rb +36 -0
- data/lib/roast/dsl/system_cogs/call.rb +163 -0
- data/lib/roast/dsl/system_cogs/map.rb +454 -0
- data/lib/roast/dsl/system_cogs/repeat.rb +242 -0
- data/lib/roast/dsl/workflow.rb +26 -16
- data/lib/roast/dsl/workflow_context.rb +20 -0
- data/lib/roast/dsl/workflow_params.rb +24 -0
- data/lib/roast/helpers/minitest_coverage_runner.rb +1 -1
- data/lib/roast/sorbet_runtime_stub.rb +154 -0
- data/lib/roast/tools/apply_diff.rb +1 -3
- data/lib/roast/tools/cmd.rb +4 -3
- data/lib/roast/tools/read_file.rb +1 -1
- data/lib/roast/tools/update_files.rb +1 -1
- data/lib/roast/tools/write_file.rb +1 -1
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/base_workflow.rb +4 -0
- data/lib/roast/workflow/step_loader.rb +14 -2
- data/lib/roast-ai.rb +4 -0
- data/lib/roast.rb +58 -21
- data/{roast.gemspec → roast-ai.gemspec} +9 -13
- data/sorbet/rbi/gems/async@2.34.0.rbi +1577 -0
- data/sorbet/rbi/gems/cli-kit@5.2.0.rbi +2063 -0
- data/sorbet/rbi/gems/{cli-ui@2.3.0.rbi → cli-ui@2.7.0-6bdefd1d06305e5d6ae312ac76f9c88f88658dda.rbi} +1418 -1013
- data/sorbet/rbi/gems/console@1.34.2.rbi +1193 -0
- data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +50 -0
- data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +35 -0
- data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +41 -0
- data/sorbet/rbi/gems/io-event@1.14.0.rbi +724 -0
- data/sorbet/rbi/gems/metrics@0.15.0.rbi +9 -0
- data/sorbet/rbi/gems/traces@0.18.2.rbi +9 -0
- data/sorbet/rbi/shims/lib/roast/dsl/cog_input_context.rbi +1185 -5
- data/sorbet/rbi/shims/lib/roast/dsl/config_context.rbi +311 -5
- data/sorbet/rbi/shims/lib/roast/dsl/execution_context.rbi +486 -5
- data/sorbet/tapioca/config.yml +6 -0
- data/sorbet/tapioca/require.rb +2 -0
- metadata +157 -30
- data/dsl/less_simple.rb +0 -112
- data/dsl/scoped_executors.rb +0 -28
- data/dsl/simple.rb +0 -8
- data/lib/roast/dsl/cogs/execute.rb +0 -46
- data/lib/roast/dsl/cogs/graph.rb +0 -53
- data/sorbet/rbi/gems/cgi@0.5.0.rbi +0 -2961
- data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +0 -568
- data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +0 -1991
- data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +0 -672
- data/sorbet/rbi/gems/dry-core@1.1.0.rbi +0 -1894
- data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +0 -659
- data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +0 -781
- data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +0 -1127
- data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +0 -3727
- data/sorbet/rbi/gems/dry-types@1.8.3.rbi +0 -3969
- data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +0 -1588
- data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +0 -136
- data/sorbet/rbi/gems/mime-types@3.7.0.rbi +0 -1342
- data/sorbet/rbi/gems/rack@2.2.19.rbi +0 -5676
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
- data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18492
|
@@ -0,0 +1,2063 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This is an autogenerated file for types exported from the `cli-kit` gem.
|
|
5
|
+
# Please instead update this file by running `bin/tapioca gem cli-kit`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# source://cli-kit//lib/cli/kit.rb#6
|
|
9
|
+
module CLI; end
|
|
10
|
+
|
|
11
|
+
# source://cli-kit//lib/cli/kit.rb#7
|
|
12
|
+
module CLI::Kit
|
|
13
|
+
class << self
|
|
14
|
+
# Mirrors the API of Kernel#raise, but with the addition of a few new
|
|
15
|
+
# optional keyword arguments. `bug` and `silent` attach metadata to the
|
|
16
|
+
# exception being raised, which is interpreted later in the ErrorHandler to
|
|
17
|
+
# decide what to print and whether to submit to bugsnag.
|
|
18
|
+
#
|
|
19
|
+
# `depth` is used to trim leading elements of the backtrace. If you wrap
|
|
20
|
+
# this method in your own wrapper, you'll want to pass `depth: 2`, for
|
|
21
|
+
# example.
|
|
22
|
+
# : (?(Class | String | Exception) exception, ?untyped string, ?Array[String]? array, ?cause: Exception?, ?bug: bool?, ?silent: bool?, ?depth: Integer) -> bot
|
|
23
|
+
#
|
|
24
|
+
# source://cli-kit//lib/cli/kit.rb#113
|
|
25
|
+
def raise(exception = T.unsafe(nil), string = T.unsafe(nil), array = T.unsafe(nil), cause: T.unsafe(nil), bug: T.unsafe(nil), silent: T.unsafe(nil), depth: T.unsafe(nil)); end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# bug:false; silent: false
|
|
30
|
+
#
|
|
31
|
+
# source://cli-kit//lib/cli/kit.rb#74
|
|
32
|
+
class CLI::Kit::Abort < ::CLI::Kit::GenericAbort
|
|
33
|
+
# : -> bool
|
|
34
|
+
#
|
|
35
|
+
# @return [Boolean]
|
|
36
|
+
#
|
|
37
|
+
# source://cli-kit//lib/cli/kit.rb#76
|
|
38
|
+
def bug?; end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# bug:false; silent:true
|
|
42
|
+
#
|
|
43
|
+
# source://cli-kit//lib/cli/kit.rb#91
|
|
44
|
+
class CLI::Kit::AbortSilent < ::CLI::Kit::GenericAbort
|
|
45
|
+
# : -> bool
|
|
46
|
+
#
|
|
47
|
+
# @return [Boolean]
|
|
48
|
+
#
|
|
49
|
+
# source://cli-kit//lib/cli/kit.rb#93
|
|
50
|
+
def bug?; end
|
|
51
|
+
|
|
52
|
+
# : -> bool
|
|
53
|
+
#
|
|
54
|
+
# @return [Boolean]
|
|
55
|
+
#
|
|
56
|
+
# source://cli-kit//lib/cli/kit.rb#98
|
|
57
|
+
def silent?; end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# source://cli-kit//lib/cli/kit/args.rb#7
|
|
61
|
+
module CLI::Kit::Args; end
|
|
62
|
+
|
|
63
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#8
|
|
64
|
+
class CLI::Kit::Args::Definition
|
|
65
|
+
# : -> void
|
|
66
|
+
#
|
|
67
|
+
# @return [Definition] a new instance of Definition
|
|
68
|
+
#
|
|
69
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#55
|
|
70
|
+
def initialize; end
|
|
71
|
+
|
|
72
|
+
# : (Symbol name, ?short: String?, ?long: String?, ?desc: String?) -> void
|
|
73
|
+
#
|
|
74
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#25
|
|
75
|
+
def add_flag(name, short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil)); end
|
|
76
|
+
|
|
77
|
+
# : (Symbol name, ?short: String?, ?long: String?, ?desc: String?, ?default: (String | ^-> String | Array[String] | ^-> Array[String])?, ?required: bool, ?multi: bool) -> void
|
|
78
|
+
#
|
|
79
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#33
|
|
80
|
+
def add_option(name, short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil), default: T.unsafe(nil), required: T.unsafe(nil), multi: T.unsafe(nil)); end
|
|
81
|
+
|
|
82
|
+
# : (Symbol name, required: bool, multi: bool, ?desc: String?, ?default: (String | ^-> String)?, ?skip: (^-> bool | ^(String arg0) -> bool)?) -> void
|
|
83
|
+
#
|
|
84
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#44
|
|
85
|
+
def add_position(name, required:, multi:, desc: T.unsafe(nil), default: T.unsafe(nil), skip: T.unsafe(nil)); end
|
|
86
|
+
|
|
87
|
+
# : Array[Flag]
|
|
88
|
+
#
|
|
89
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#16
|
|
90
|
+
def flags; end
|
|
91
|
+
|
|
92
|
+
# : (Symbol name) -> Flag?
|
|
93
|
+
#
|
|
94
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#179
|
|
95
|
+
def lookup_flag(name); end
|
|
96
|
+
|
|
97
|
+
# : (String name) -> (Flag | Option)?
|
|
98
|
+
#
|
|
99
|
+
# @raise [InvalidLookup]
|
|
100
|
+
#
|
|
101
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#202
|
|
102
|
+
def lookup_long(name); end
|
|
103
|
+
|
|
104
|
+
# : (Symbol name) -> Option?
|
|
105
|
+
#
|
|
106
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#187
|
|
107
|
+
def lookup_option(name); end
|
|
108
|
+
|
|
109
|
+
# : (Symbol name) -> Position?
|
|
110
|
+
#
|
|
111
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#209
|
|
112
|
+
def lookup_position(name); end
|
|
113
|
+
|
|
114
|
+
# : (String name) -> (Flag | Option)?
|
|
115
|
+
#
|
|
116
|
+
# @raise [InvalidLookup]
|
|
117
|
+
#
|
|
118
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#195
|
|
119
|
+
def lookup_short(name); end
|
|
120
|
+
|
|
121
|
+
# : Array[Option]
|
|
122
|
+
#
|
|
123
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#19
|
|
124
|
+
def options; end
|
|
125
|
+
|
|
126
|
+
# : Array[Position]
|
|
127
|
+
#
|
|
128
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#22
|
|
129
|
+
def positions; end
|
|
130
|
+
|
|
131
|
+
private
|
|
132
|
+
|
|
133
|
+
# : ((Flag | Position) arg) -> void
|
|
134
|
+
#
|
|
135
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#276
|
|
136
|
+
def add_name_resolution(arg); end
|
|
137
|
+
|
|
138
|
+
# : (Flag flagopt) -> void
|
|
139
|
+
#
|
|
140
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#257
|
|
141
|
+
def add_resolution(flagopt); end
|
|
142
|
+
|
|
143
|
+
# : (String long) -> String
|
|
144
|
+
#
|
|
145
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#236
|
|
146
|
+
def strip_long_prefix(long); end
|
|
147
|
+
|
|
148
|
+
# : (String? short, String? long) -> [String?, String?]
|
|
149
|
+
#
|
|
150
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#245
|
|
151
|
+
def strip_prefixes_and_validate(short, long); end
|
|
152
|
+
|
|
153
|
+
# : (String short) -> String
|
|
154
|
+
#
|
|
155
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#224
|
|
156
|
+
def strip_short_prefix(short); end
|
|
157
|
+
|
|
158
|
+
# : (Position position) -> void
|
|
159
|
+
#
|
|
160
|
+
# @raise [InvalidPosition]
|
|
161
|
+
#
|
|
162
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#219
|
|
163
|
+
def validate_order(position); end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#10
|
|
167
|
+
class CLI::Kit::Args::Definition::ConflictingFlag < ::CLI::Kit::Args::Definition::Error; end
|
|
168
|
+
|
|
169
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#9
|
|
170
|
+
class CLI::Kit::Args::Definition::Error < ::CLI::Kit::Args::Error; end
|
|
171
|
+
|
|
172
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#103
|
|
173
|
+
class CLI::Kit::Args::Definition::Flag
|
|
174
|
+
include ::CLI::Kit::Args::Definition::OptBase
|
|
175
|
+
|
|
176
|
+
# : (name: Symbol, ?short: String?, ?long: String?, ?desc: String?) -> void
|
|
177
|
+
#
|
|
178
|
+
# @return [Flag] a new instance of Flag
|
|
179
|
+
#
|
|
180
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#118
|
|
181
|
+
def initialize(name:, short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil)); end
|
|
182
|
+
|
|
183
|
+
# : -> String
|
|
184
|
+
#
|
|
185
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#113
|
|
186
|
+
def as_written_by_user; end
|
|
187
|
+
|
|
188
|
+
# : String?
|
|
189
|
+
#
|
|
190
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#110
|
|
191
|
+
def long; end
|
|
192
|
+
|
|
193
|
+
# : String?
|
|
194
|
+
#
|
|
195
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#107
|
|
196
|
+
def short; end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#11
|
|
200
|
+
class CLI::Kit::Args::Definition::InvalidFlag < ::CLI::Kit::Args::Definition::Error; end
|
|
201
|
+
|
|
202
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#12
|
|
203
|
+
class CLI::Kit::Args::Definition::InvalidLookup < ::CLI::Kit::Args::Definition::Error; end
|
|
204
|
+
|
|
205
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#13
|
|
206
|
+
class CLI::Kit::Args::Definition::InvalidPosition < ::CLI::Kit::Args::Definition::Error; end
|
|
207
|
+
|
|
208
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#64
|
|
209
|
+
module CLI::Kit::Args::Definition::OptBase
|
|
210
|
+
# : String?
|
|
211
|
+
#
|
|
212
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#69
|
|
213
|
+
def desc; end
|
|
214
|
+
|
|
215
|
+
# : Symbol
|
|
216
|
+
#
|
|
217
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#66
|
|
218
|
+
def name; end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#72
|
|
222
|
+
module CLI::Kit::Args::Definition::OptValue
|
|
223
|
+
# : -> (String | Array[String])?
|
|
224
|
+
#
|
|
225
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#74
|
|
226
|
+
def default; end
|
|
227
|
+
|
|
228
|
+
# : -> bool
|
|
229
|
+
#
|
|
230
|
+
# @return [Boolean]
|
|
231
|
+
#
|
|
232
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#83
|
|
233
|
+
def dynamic_default?; end
|
|
234
|
+
|
|
235
|
+
# : -> bool
|
|
236
|
+
#
|
|
237
|
+
# @return [Boolean]
|
|
238
|
+
#
|
|
239
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#93
|
|
240
|
+
def multi?; end
|
|
241
|
+
|
|
242
|
+
# : -> bool
|
|
243
|
+
#
|
|
244
|
+
# @return [Boolean]
|
|
245
|
+
#
|
|
246
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#98
|
|
247
|
+
def optional?; end
|
|
248
|
+
|
|
249
|
+
# : -> bool
|
|
250
|
+
#
|
|
251
|
+
# @return [Boolean]
|
|
252
|
+
#
|
|
253
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#88
|
|
254
|
+
def required?; end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#162
|
|
258
|
+
class CLI::Kit::Args::Definition::Option < ::CLI::Kit::Args::Definition::Flag
|
|
259
|
+
include ::CLI::Kit::Args::Definition::OptValue
|
|
260
|
+
|
|
261
|
+
# : (name: Symbol, ?short: String?, ?long: String?, ?desc: String?, ?default: (String | ^-> String | Array[String] | ^-> Array[String])?, ?required: bool, ?multi: bool) -> void
|
|
262
|
+
#
|
|
263
|
+
# @return [Option] a new instance of Option
|
|
264
|
+
#
|
|
265
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#166
|
|
266
|
+
def initialize(name:, short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil), default: T.unsafe(nil), required: T.unsafe(nil), multi: T.unsafe(nil)); end
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#130
|
|
270
|
+
class CLI::Kit::Args::Definition::Position
|
|
271
|
+
include ::CLI::Kit::Args::Definition::OptBase
|
|
272
|
+
include ::CLI::Kit::Args::Definition::OptValue
|
|
273
|
+
|
|
274
|
+
# : (name: Symbol, desc: String?, required: bool, multi: bool, ?default: (String | ^-> String)?, ?skip: (^-> bool | ^(String arg0) -> bool)?) -> void
|
|
275
|
+
#
|
|
276
|
+
# @return [Position] a new instance of Position
|
|
277
|
+
#
|
|
278
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#135
|
|
279
|
+
def initialize(name:, desc:, required:, multi:, default: T.unsafe(nil), skip: T.unsafe(nil)); end
|
|
280
|
+
|
|
281
|
+
# : (String arg) -> bool
|
|
282
|
+
#
|
|
283
|
+
# @return [Boolean]
|
|
284
|
+
#
|
|
285
|
+
# source://cli-kit//lib/cli/kit/args/definition.rb#149
|
|
286
|
+
def skip?(arg); end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# source://cli-kit//lib/cli/kit/args.rb#8
|
|
290
|
+
class CLI::Kit::Args::Error < ::StandardError; end
|
|
291
|
+
|
|
292
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#8
|
|
293
|
+
class CLI::Kit::Args::Evaluation
|
|
294
|
+
# : (Definition defn, Array[Parser::Node] parse) -> void
|
|
295
|
+
#
|
|
296
|
+
# @return [Evaluation] a new instance of Evaluation
|
|
297
|
+
#
|
|
298
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#128
|
|
299
|
+
def initialize(defn, parse); end
|
|
300
|
+
|
|
301
|
+
# : -> void
|
|
302
|
+
#
|
|
303
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#135
|
|
304
|
+
def check_required_options!; end
|
|
305
|
+
|
|
306
|
+
# : Definition
|
|
307
|
+
#
|
|
308
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#114
|
|
309
|
+
def defn; end
|
|
310
|
+
|
|
311
|
+
# : -> FlagProxy
|
|
312
|
+
#
|
|
313
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#99
|
|
314
|
+
def flag; end
|
|
315
|
+
|
|
316
|
+
# : (Definition::Flag flag) -> bool
|
|
317
|
+
#
|
|
318
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#175
|
|
319
|
+
def lookup_flag(flag); end
|
|
320
|
+
|
|
321
|
+
# : (Definition::Option opt) -> (String | Array[String])?
|
|
322
|
+
#
|
|
323
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#188
|
|
324
|
+
def lookup_option(opt); end
|
|
325
|
+
|
|
326
|
+
# : (Definition::Position position) -> (String | Array[String])?
|
|
327
|
+
#
|
|
328
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#199
|
|
329
|
+
def lookup_position(position); end
|
|
330
|
+
|
|
331
|
+
# : -> OptionProxy
|
|
332
|
+
#
|
|
333
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#104
|
|
334
|
+
def opt; end
|
|
335
|
+
|
|
336
|
+
# : Array[Parser::Node]
|
|
337
|
+
#
|
|
338
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#117
|
|
339
|
+
def parse; end
|
|
340
|
+
|
|
341
|
+
# : -> PositionProxy
|
|
342
|
+
#
|
|
343
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#109
|
|
344
|
+
def position; end
|
|
345
|
+
|
|
346
|
+
# : -> void
|
|
347
|
+
#
|
|
348
|
+
# @raise [TooManyPositions]
|
|
349
|
+
#
|
|
350
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#154
|
|
351
|
+
def resolve_positions!; end
|
|
352
|
+
|
|
353
|
+
# : -> Array[String]
|
|
354
|
+
#
|
|
355
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#120
|
|
356
|
+
def unparsed; end
|
|
357
|
+
|
|
358
|
+
private
|
|
359
|
+
|
|
360
|
+
# : -> Array[String]
|
|
361
|
+
#
|
|
362
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#206
|
|
363
|
+
def args; end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#9
|
|
367
|
+
class CLI::Kit::Args::Evaluation::Error < ::CLI::Kit::Args::Error; end
|
|
368
|
+
|
|
369
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#32
|
|
370
|
+
class CLI::Kit::Args::Evaluation::FlagProxy
|
|
371
|
+
# : (Evaluation evaluation) -> void
|
|
372
|
+
#
|
|
373
|
+
# @return [FlagProxy] a new instance of FlagProxy
|
|
374
|
+
#
|
|
375
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#49
|
|
376
|
+
def initialize(evaluation); end
|
|
377
|
+
|
|
378
|
+
# : (Symbol sym) -> bool
|
|
379
|
+
#
|
|
380
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#34
|
|
381
|
+
def method_missing(sym); end
|
|
382
|
+
|
|
383
|
+
private
|
|
384
|
+
|
|
385
|
+
# : (Symbol sym, ?bool include_private) -> bool
|
|
386
|
+
#
|
|
387
|
+
# @return [Boolean]
|
|
388
|
+
#
|
|
389
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#44
|
|
390
|
+
def respond_to_missing?(sym, include_private = T.unsafe(nil)); end
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#11
|
|
394
|
+
class CLI::Kit::Args::Evaluation::MissingRequiredOption < ::CLI::Kit::Args::Evaluation::Error
|
|
395
|
+
# : (String name) -> void
|
|
396
|
+
#
|
|
397
|
+
# @return [MissingRequiredOption] a new instance of MissingRequiredOption
|
|
398
|
+
#
|
|
399
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#13
|
|
400
|
+
def initialize(name); end
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#18
|
|
404
|
+
class CLI::Kit::Args::Evaluation::MissingRequiredPosition < ::CLI::Kit::Args::Evaluation::Error
|
|
405
|
+
# : -> void
|
|
406
|
+
#
|
|
407
|
+
# @return [MissingRequiredPosition] a new instance of MissingRequiredPosition
|
|
408
|
+
#
|
|
409
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#20
|
|
410
|
+
def initialize; end
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#54
|
|
414
|
+
class CLI::Kit::Args::Evaluation::OptionProxy
|
|
415
|
+
# : (Evaluation evaluation) -> void
|
|
416
|
+
#
|
|
417
|
+
# @return [OptionProxy] a new instance of OptionProxy
|
|
418
|
+
#
|
|
419
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#71
|
|
420
|
+
def initialize(evaluation); end
|
|
421
|
+
|
|
422
|
+
# : (Symbol sym) -> (String | Array[String])?
|
|
423
|
+
#
|
|
424
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#56
|
|
425
|
+
def method_missing(sym); end
|
|
426
|
+
|
|
427
|
+
private
|
|
428
|
+
|
|
429
|
+
# : (Symbol sym, ?bool include_private) -> bool
|
|
430
|
+
#
|
|
431
|
+
# @return [Boolean]
|
|
432
|
+
#
|
|
433
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#66
|
|
434
|
+
def respond_to_missing?(sym, include_private = T.unsafe(nil)); end
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#76
|
|
438
|
+
class CLI::Kit::Args::Evaluation::PositionProxy
|
|
439
|
+
# : (Evaluation evaluation) -> void
|
|
440
|
+
#
|
|
441
|
+
# @return [PositionProxy] a new instance of PositionProxy
|
|
442
|
+
#
|
|
443
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#93
|
|
444
|
+
def initialize(evaluation); end
|
|
445
|
+
|
|
446
|
+
# : (Symbol sym) -> (String | Array[String])?
|
|
447
|
+
#
|
|
448
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#78
|
|
449
|
+
def method_missing(sym); end
|
|
450
|
+
|
|
451
|
+
private
|
|
452
|
+
|
|
453
|
+
# : (Symbol sym, ?bool include_private) -> bool
|
|
454
|
+
#
|
|
455
|
+
# @return [Boolean]
|
|
456
|
+
#
|
|
457
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#88
|
|
458
|
+
def respond_to_missing?(sym, include_private = T.unsafe(nil)); end
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#25
|
|
462
|
+
class CLI::Kit::Args::Evaluation::TooManyPositions < ::CLI::Kit::Args::Evaluation::Error
|
|
463
|
+
# : -> void
|
|
464
|
+
#
|
|
465
|
+
# @return [TooManyPositions] a new instance of TooManyPositions
|
|
466
|
+
#
|
|
467
|
+
# source://cli-kit//lib/cli/kit/args/evaluation.rb#27
|
|
468
|
+
def initialize; end
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#8
|
|
472
|
+
class CLI::Kit::Args::Parser
|
|
473
|
+
# : (Definition definition) -> void
|
|
474
|
+
#
|
|
475
|
+
# @return [Parser] a new instance of Parser
|
|
476
|
+
#
|
|
477
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#63
|
|
478
|
+
def initialize(definition); end
|
|
479
|
+
|
|
480
|
+
# : (Array[Tokenizer::Token] tokens) -> Array[Node]
|
|
481
|
+
#
|
|
482
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#28
|
|
483
|
+
def parse(tokens); end
|
|
484
|
+
|
|
485
|
+
private
|
|
486
|
+
|
|
487
|
+
# : (Tokenizer::Token::OptionName arg, Tokenizer::Token? next_arg) -> Node
|
|
488
|
+
#
|
|
489
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#104
|
|
490
|
+
def parse_option(arg, next_arg); end
|
|
491
|
+
|
|
492
|
+
# : (Tokenizer::Token token, Tokenizer::Token? next_token) -> [Symbol, Parser::Node]
|
|
493
|
+
#
|
|
494
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#70
|
|
495
|
+
def parse_token(token, next_token); end
|
|
496
|
+
end
|
|
497
|
+
|
|
498
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#11
|
|
499
|
+
class CLI::Kit::Args::Parser::Error < ::CLI::Kit::Args::Error; end
|
|
500
|
+
|
|
501
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#13
|
|
502
|
+
class CLI::Kit::Args::Parser::InvalidOptionError < ::CLI::Kit::Args::Parser::Error
|
|
503
|
+
# : (String option) -> void
|
|
504
|
+
#
|
|
505
|
+
# @return [InvalidOptionError] a new instance of InvalidOptionError
|
|
506
|
+
#
|
|
507
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#15
|
|
508
|
+
def initialize(option); end
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#9
|
|
512
|
+
class CLI::Kit::Args::Parser::Node
|
|
513
|
+
# : -> void
|
|
514
|
+
#
|
|
515
|
+
# @return [Node] a new instance of Node
|
|
516
|
+
#
|
|
517
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#11
|
|
518
|
+
def initialize; end
|
|
519
|
+
|
|
520
|
+
# : (untyped other) -> bool
|
|
521
|
+
#
|
|
522
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#15
|
|
523
|
+
def ==(other); end
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#83
|
|
527
|
+
class CLI::Kit::Args::Parser::Node::Argument < ::CLI::Kit::Args::Parser::Node
|
|
528
|
+
# : (String value) -> void
|
|
529
|
+
#
|
|
530
|
+
# @return [Argument] a new instance of Argument
|
|
531
|
+
#
|
|
532
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#88
|
|
533
|
+
def initialize(value); end
|
|
534
|
+
|
|
535
|
+
# : (untyped other) -> bool
|
|
536
|
+
#
|
|
537
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#99
|
|
538
|
+
def ==(other); end
|
|
539
|
+
|
|
540
|
+
# : -> String
|
|
541
|
+
#
|
|
542
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#94
|
|
543
|
+
def inspect; end
|
|
544
|
+
|
|
545
|
+
# : String
|
|
546
|
+
#
|
|
547
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#85
|
|
548
|
+
def value; end
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#53
|
|
552
|
+
class CLI::Kit::Args::Parser::Node::Flag < ::CLI::Kit::Args::Parser::Node
|
|
553
|
+
# : (String value) -> void
|
|
554
|
+
#
|
|
555
|
+
# @return [Flag] a new instance of Flag
|
|
556
|
+
#
|
|
557
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#58
|
|
558
|
+
def initialize(value); end
|
|
559
|
+
|
|
560
|
+
# : (untyped other) -> bool
|
|
561
|
+
#
|
|
562
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#70
|
|
563
|
+
def ==(other); end
|
|
564
|
+
|
|
565
|
+
# : -> String
|
|
566
|
+
#
|
|
567
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#65
|
|
568
|
+
def inspect; end
|
|
569
|
+
|
|
570
|
+
# : String
|
|
571
|
+
#
|
|
572
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#55
|
|
573
|
+
def value; end
|
|
574
|
+
|
|
575
|
+
class << self
|
|
576
|
+
private
|
|
577
|
+
|
|
578
|
+
def new(*_arg0); end
|
|
579
|
+
end
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#75
|
|
583
|
+
class CLI::Kit::Args::Parser::Node::LongFlag < ::CLI::Kit::Args::Parser::Node::Flag
|
|
584
|
+
class << self
|
|
585
|
+
def new(*_arg0); end
|
|
586
|
+
end
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#45
|
|
590
|
+
class CLI::Kit::Args::Parser::Node::LongOption < ::CLI::Kit::Args::Parser::Node::Option
|
|
591
|
+
class << self
|
|
592
|
+
def new(*_arg0); end
|
|
593
|
+
end
|
|
594
|
+
end
|
|
595
|
+
|
|
596
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#19
|
|
597
|
+
class CLI::Kit::Args::Parser::Node::Option < ::CLI::Kit::Args::Parser::Node
|
|
598
|
+
# : (String name, String value) -> void
|
|
599
|
+
#
|
|
600
|
+
# @return [Option] a new instance of Option
|
|
601
|
+
#
|
|
602
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#27
|
|
603
|
+
def initialize(name, value); end
|
|
604
|
+
|
|
605
|
+
# : (untyped other) -> bool
|
|
606
|
+
#
|
|
607
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#40
|
|
608
|
+
def ==(other); end
|
|
609
|
+
|
|
610
|
+
# : -> String
|
|
611
|
+
#
|
|
612
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#35
|
|
613
|
+
def inspect; end
|
|
614
|
+
|
|
615
|
+
# : String
|
|
616
|
+
#
|
|
617
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#21
|
|
618
|
+
def name; end
|
|
619
|
+
|
|
620
|
+
# : String
|
|
621
|
+
#
|
|
622
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#24
|
|
623
|
+
def value; end
|
|
624
|
+
|
|
625
|
+
class << self
|
|
626
|
+
private
|
|
627
|
+
|
|
628
|
+
def new(*_arg0); end
|
|
629
|
+
end
|
|
630
|
+
end
|
|
631
|
+
|
|
632
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#79
|
|
633
|
+
class CLI::Kit::Args::Parser::Node::ShortFlag < ::CLI::Kit::Args::Parser::Node::Flag
|
|
634
|
+
class << self
|
|
635
|
+
def new(*_arg0); end
|
|
636
|
+
end
|
|
637
|
+
end
|
|
638
|
+
|
|
639
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#49
|
|
640
|
+
class CLI::Kit::Args::Parser::Node::ShortOption < ::CLI::Kit::Args::Parser::Node::Option
|
|
641
|
+
class << self
|
|
642
|
+
def new(*_arg0); end
|
|
643
|
+
end
|
|
644
|
+
end
|
|
645
|
+
|
|
646
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#104
|
|
647
|
+
class CLI::Kit::Args::Parser::Node::Unparsed < ::CLI::Kit::Args::Parser::Node
|
|
648
|
+
# : (Array[String] value) -> void
|
|
649
|
+
#
|
|
650
|
+
# @return [Unparsed] a new instance of Unparsed
|
|
651
|
+
#
|
|
652
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#109
|
|
653
|
+
def initialize(value); end
|
|
654
|
+
|
|
655
|
+
# : (untyped other) -> bool
|
|
656
|
+
#
|
|
657
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#120
|
|
658
|
+
def ==(other); end
|
|
659
|
+
|
|
660
|
+
# : -> String
|
|
661
|
+
#
|
|
662
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#115
|
|
663
|
+
def inspect; end
|
|
664
|
+
|
|
665
|
+
# : Array[String]
|
|
666
|
+
#
|
|
667
|
+
# source://cli-kit//lib/cli/kit/args/parser/node.rb#106
|
|
668
|
+
def value; end
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#20
|
|
672
|
+
class CLI::Kit::Args::Parser::OptionRequiresAnArgumentError < ::CLI::Kit::Args::Parser::Error
|
|
673
|
+
# : (String option) -> void
|
|
674
|
+
#
|
|
675
|
+
# @return [OptionRequiresAnArgumentError] a new instance of OptionRequiresAnArgumentError
|
|
676
|
+
#
|
|
677
|
+
# source://cli-kit//lib/cli/kit/args/parser.rb#22
|
|
678
|
+
def initialize(option); end
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#8
|
|
682
|
+
module CLI::Kit::Args::Tokenizer
|
|
683
|
+
class << self
|
|
684
|
+
# : (Array[String] raw_args) -> Array[Token]
|
|
685
|
+
#
|
|
686
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#56
|
|
687
|
+
def tokenize(raw_args); end
|
|
688
|
+
|
|
689
|
+
# : (String arg) -> Array[Token]
|
|
690
|
+
#
|
|
691
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#96
|
|
692
|
+
def tokenize_short_option(arg); end
|
|
693
|
+
end
|
|
694
|
+
end
|
|
695
|
+
|
|
696
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#9
|
|
697
|
+
class CLI::Kit::Args::Tokenizer::Error < ::CLI::Kit::Args::Error; end
|
|
698
|
+
|
|
699
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#18
|
|
700
|
+
class CLI::Kit::Args::Tokenizer::InvalidCharInShortOption < ::CLI::Kit::Args::Tokenizer::Error
|
|
701
|
+
# : (String short_option, String char) -> void
|
|
702
|
+
#
|
|
703
|
+
# @return [InvalidCharInShortOption] a new instance of InvalidCharInShortOption
|
|
704
|
+
#
|
|
705
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#20
|
|
706
|
+
def initialize(short_option, char); end
|
|
707
|
+
end
|
|
708
|
+
|
|
709
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#11
|
|
710
|
+
class CLI::Kit::Args::Tokenizer::InvalidShortOption < ::CLI::Kit::Args::Tokenizer::Error
|
|
711
|
+
# : (String short_option) -> void
|
|
712
|
+
#
|
|
713
|
+
# @return [InvalidShortOption] a new instance of InvalidShortOption
|
|
714
|
+
#
|
|
715
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#13
|
|
716
|
+
def initialize(short_option); end
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#25
|
|
720
|
+
class CLI::Kit::Args::Tokenizer::Token
|
|
721
|
+
# : (String value) -> void
|
|
722
|
+
#
|
|
723
|
+
# @return [Token] a new instance of Token
|
|
724
|
+
#
|
|
725
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#30
|
|
726
|
+
def initialize(value); end
|
|
727
|
+
|
|
728
|
+
# : (untyped other) -> bool
|
|
729
|
+
#
|
|
730
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#40
|
|
731
|
+
def ==(other); end
|
|
732
|
+
|
|
733
|
+
# : -> String
|
|
734
|
+
#
|
|
735
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#35
|
|
736
|
+
def inspect; end
|
|
737
|
+
|
|
738
|
+
# : String
|
|
739
|
+
#
|
|
740
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#27
|
|
741
|
+
def value; end
|
|
742
|
+
end
|
|
743
|
+
|
|
744
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#45
|
|
745
|
+
class CLI::Kit::Args::Tokenizer::Token::LongOptionName < ::CLI::Kit::Args::Tokenizer::Token::OptionName; end
|
|
746
|
+
|
|
747
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#44
|
|
748
|
+
class CLI::Kit::Args::Tokenizer::Token::OptionName < ::CLI::Kit::Args::Tokenizer::Token; end
|
|
749
|
+
|
|
750
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#48
|
|
751
|
+
class CLI::Kit::Args::Tokenizer::Token::OptionValue < ::CLI::Kit::Args::Tokenizer::Token; end
|
|
752
|
+
|
|
753
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#50
|
|
754
|
+
class CLI::Kit::Args::Tokenizer::Token::OptionValueOrPositionalArgument < ::CLI::Kit::Args::Tokenizer::Token; end
|
|
755
|
+
|
|
756
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#49
|
|
757
|
+
class CLI::Kit::Args::Tokenizer::Token::PositionalArgument < ::CLI::Kit::Args::Tokenizer::Token; end
|
|
758
|
+
|
|
759
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#46
|
|
760
|
+
class CLI::Kit::Args::Tokenizer::Token::ShortOptionName < ::CLI::Kit::Args::Tokenizer::Token::OptionName; end
|
|
761
|
+
|
|
762
|
+
# source://cli-kit//lib/cli/kit/args/tokenizer.rb#51
|
|
763
|
+
class CLI::Kit::Args::Tokenizer::Token::UnparsedArgument < ::CLI::Kit::Args::Tokenizer::Token; end
|
|
764
|
+
|
|
765
|
+
# @abstract
|
|
766
|
+
#
|
|
767
|
+
# source://cli-kit//lib/cli/kit/base_command.rb#8
|
|
768
|
+
class CLI::Kit::BaseCommand
|
|
769
|
+
include ::CLI::Kit::CommandHelp
|
|
770
|
+
extend ::CLI::Kit::CommandHelp::ClassMethods
|
|
771
|
+
|
|
772
|
+
# : -> bool
|
|
773
|
+
#
|
|
774
|
+
# @return [Boolean]
|
|
775
|
+
#
|
|
776
|
+
# source://cli-kit//lib/cli/kit/base_command.rb#25
|
|
777
|
+
def has_subcommands?; end
|
|
778
|
+
|
|
779
|
+
class << self
|
|
780
|
+
# : (Array[String] args, String command_name) -> void
|
|
781
|
+
#
|
|
782
|
+
# source://cli-kit//lib/cli/kit/base_command.rb#19
|
|
783
|
+
def call(args, command_name); end
|
|
784
|
+
|
|
785
|
+
# : -> bool
|
|
786
|
+
#
|
|
787
|
+
# @return [Boolean]
|
|
788
|
+
#
|
|
789
|
+
# source://cli-kit//lib/cli/kit/base_command.rb#14
|
|
790
|
+
def defined?; end
|
|
791
|
+
end
|
|
792
|
+
end
|
|
793
|
+
|
|
794
|
+
# bug:true; silent:false
|
|
795
|
+
#
|
|
796
|
+
# source://cli-kit//lib/cli/kit.rb#81
|
|
797
|
+
class CLI::Kit::Bug < ::CLI::Kit::GenericAbort; end
|
|
798
|
+
|
|
799
|
+
# bug:true; silent:true
|
|
800
|
+
#
|
|
801
|
+
# source://cli-kit//lib/cli/kit.rb#84
|
|
802
|
+
class CLI::Kit::BugSilent < ::CLI::Kit::GenericAbort
|
|
803
|
+
# : -> bool
|
|
804
|
+
#
|
|
805
|
+
# @return [Boolean]
|
|
806
|
+
#
|
|
807
|
+
# source://cli-kit//lib/cli/kit.rb#86
|
|
808
|
+
def silent?; end
|
|
809
|
+
end
|
|
810
|
+
|
|
811
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#7
|
|
812
|
+
module CLI::Kit::CommandHelp
|
|
813
|
+
include ::Kernel
|
|
814
|
+
|
|
815
|
+
# : (Array[String] args, String name) -> void
|
|
816
|
+
#
|
|
817
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#11
|
|
818
|
+
def call(args, name); end
|
|
819
|
+
|
|
820
|
+
# : (untyped op, String name) -> void
|
|
821
|
+
#
|
|
822
|
+
# @raise [NotImplementedError]
|
|
823
|
+
#
|
|
824
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#44
|
|
825
|
+
def invoke(op, name); end
|
|
826
|
+
|
|
827
|
+
# use to implement error handling
|
|
828
|
+
# : (untyped op, String name) -> void
|
|
829
|
+
#
|
|
830
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#39
|
|
831
|
+
def invoke_wrapper(op, name); end
|
|
832
|
+
|
|
833
|
+
class << self
|
|
834
|
+
# : -> Integer
|
|
835
|
+
#
|
|
836
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#65
|
|
837
|
+
def _max_desc_length; end
|
|
838
|
+
|
|
839
|
+
# : -> String
|
|
840
|
+
#
|
|
841
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#56
|
|
842
|
+
def _tool_name; end
|
|
843
|
+
|
|
844
|
+
# : Integer
|
|
845
|
+
#
|
|
846
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#53
|
|
847
|
+
def max_desc_length=(_arg0); end
|
|
848
|
+
|
|
849
|
+
# : String
|
|
850
|
+
#
|
|
851
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#50
|
|
852
|
+
def tool_name=(_arg0); end
|
|
853
|
+
end
|
|
854
|
+
end
|
|
855
|
+
|
|
856
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#70
|
|
857
|
+
module CLI::Kit::CommandHelp::ClassMethods
|
|
858
|
+
include ::Kernel
|
|
859
|
+
|
|
860
|
+
# : -> String
|
|
861
|
+
#
|
|
862
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#103
|
|
863
|
+
def _command_name; end
|
|
864
|
+
|
|
865
|
+
# : -> String
|
|
866
|
+
#
|
|
867
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#111
|
|
868
|
+
def _desc; end
|
|
869
|
+
|
|
870
|
+
# : -> String
|
|
871
|
+
#
|
|
872
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#116
|
|
873
|
+
def build_desc; end
|
|
874
|
+
|
|
875
|
+
# : -> String?
|
|
876
|
+
#
|
|
877
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#237
|
|
878
|
+
def build_examples; end
|
|
879
|
+
|
|
880
|
+
# : -> String
|
|
881
|
+
#
|
|
882
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#82
|
|
883
|
+
def build_help; end
|
|
884
|
+
|
|
885
|
+
# : -> String?
|
|
886
|
+
#
|
|
887
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#133
|
|
888
|
+
def build_options; end
|
|
889
|
+
|
|
890
|
+
# : -> String
|
|
891
|
+
#
|
|
892
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#223
|
|
893
|
+
def build_usage; end
|
|
894
|
+
|
|
895
|
+
# : (String command_name) -> void
|
|
896
|
+
#
|
|
897
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#185
|
|
898
|
+
def command_name(command_name); end
|
|
899
|
+
|
|
900
|
+
# : (String desc) -> void
|
|
901
|
+
#
|
|
902
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#194
|
|
903
|
+
def desc(desc); end
|
|
904
|
+
|
|
905
|
+
# : (String command, String? explanation) -> void
|
|
906
|
+
#
|
|
907
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#261
|
|
908
|
+
def example(command, explanation); end
|
|
909
|
+
|
|
910
|
+
# : (Array[Symbol] sections) -> void
|
|
911
|
+
#
|
|
912
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#180
|
|
913
|
+
def help_sections(sections); end
|
|
914
|
+
|
|
915
|
+
# : (String long_desc) -> void
|
|
916
|
+
#
|
|
917
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#214
|
|
918
|
+
def long_desc(long_desc); end
|
|
919
|
+
|
|
920
|
+
# : -> untyped
|
|
921
|
+
#
|
|
922
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#125
|
|
923
|
+
def opts_class; end
|
|
924
|
+
|
|
925
|
+
# : (String usage) -> void
|
|
926
|
+
#
|
|
927
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#255
|
|
928
|
+
def usage(usage); end
|
|
929
|
+
end
|
|
930
|
+
|
|
931
|
+
# source://cli-kit//lib/cli/kit/command_help.rb#73
|
|
932
|
+
CLI::Kit::CommandHelp::ClassMethods::DEFAULT_HELP_SECTIONS = T.let(T.unsafe(nil), Array)
|
|
933
|
+
|
|
934
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#7
|
|
935
|
+
class CLI::Kit::CommandRegistry
|
|
936
|
+
# : (default: String, ?contextual_resolver: ContextualResolver) -> void
|
|
937
|
+
#
|
|
938
|
+
# @return [CommandRegistry] a new instance of CommandRegistry
|
|
939
|
+
#
|
|
940
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#62
|
|
941
|
+
def initialize(default:, contextual_resolver: T.unsafe(nil)); end
|
|
942
|
+
|
|
943
|
+
# : (command_or_proc const, String name) -> void
|
|
944
|
+
#
|
|
945
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#77
|
|
946
|
+
def add(const, name); end
|
|
947
|
+
|
|
948
|
+
# : (String from, String to) -> void
|
|
949
|
+
#
|
|
950
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#90
|
|
951
|
+
def add_alias(from, to); end
|
|
952
|
+
|
|
953
|
+
# : Hash[String, String]
|
|
954
|
+
#
|
|
955
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#14
|
|
956
|
+
def aliases; end
|
|
957
|
+
|
|
958
|
+
# : -> Array[String]
|
|
959
|
+
#
|
|
960
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#95
|
|
961
|
+
def command_names; end
|
|
962
|
+
|
|
963
|
+
# : Hash[String, command_or_proc]
|
|
964
|
+
#
|
|
965
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#11
|
|
966
|
+
def commands; end
|
|
967
|
+
|
|
968
|
+
# : (String name) -> bool
|
|
969
|
+
#
|
|
970
|
+
# @return [Boolean]
|
|
971
|
+
#
|
|
972
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#100
|
|
973
|
+
def exist?(name); end
|
|
974
|
+
|
|
975
|
+
# : (String? name) -> [singleton(CLI::Kit::BaseCommand)?, String]
|
|
976
|
+
#
|
|
977
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#82
|
|
978
|
+
def lookup_command(name); end
|
|
979
|
+
|
|
980
|
+
# : -> Hash[String, singleton(CLI::Kit::BaseCommand)]
|
|
981
|
+
#
|
|
982
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#70
|
|
983
|
+
def resolved_commands; end
|
|
984
|
+
|
|
985
|
+
private
|
|
986
|
+
|
|
987
|
+
# : (String name) -> String
|
|
988
|
+
#
|
|
989
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#107
|
|
990
|
+
def resolve_alias(name); end
|
|
991
|
+
|
|
992
|
+
# : (command_or_proc? class_or_proc) -> singleton(CLI::Kit::BaseCommand)?
|
|
993
|
+
#
|
|
994
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#138
|
|
995
|
+
def resolve_class(class_or_proc); end
|
|
996
|
+
|
|
997
|
+
# : (String name) -> [singleton(CLI::Kit::BaseCommand)?, String]
|
|
998
|
+
#
|
|
999
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#112
|
|
1000
|
+
def resolve_command(name); end
|
|
1001
|
+
|
|
1002
|
+
# : (String name) -> [singleton(CLI::Kit::BaseCommand), String]?
|
|
1003
|
+
#
|
|
1004
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#130
|
|
1005
|
+
def resolve_contextual_command(name); end
|
|
1006
|
+
|
|
1007
|
+
# : (String name) -> [singleton(CLI::Kit::BaseCommand), String]?
|
|
1008
|
+
#
|
|
1009
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#120
|
|
1010
|
+
def resolve_global_command(name); end
|
|
1011
|
+
end
|
|
1012
|
+
|
|
1013
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#17
|
|
1014
|
+
module CLI::Kit::CommandRegistry::ContextualResolver
|
|
1015
|
+
# : -> Hash[String, String]
|
|
1016
|
+
#
|
|
1017
|
+
# @abstract
|
|
1018
|
+
# @raise [NotImplementedError]
|
|
1019
|
+
#
|
|
1020
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#26
|
|
1021
|
+
def aliases; end
|
|
1022
|
+
|
|
1023
|
+
# : (String) -> singleton(CLI::Kit::BaseCommand)
|
|
1024
|
+
#
|
|
1025
|
+
# @abstract
|
|
1026
|
+
# @raise [NotImplementedError]
|
|
1027
|
+
#
|
|
1028
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#32
|
|
1029
|
+
def command_class(_name); end
|
|
1030
|
+
|
|
1031
|
+
# : -> Array[String]
|
|
1032
|
+
#
|
|
1033
|
+
# @abstract
|
|
1034
|
+
# @raise [NotImplementedError]
|
|
1035
|
+
#
|
|
1036
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#20
|
|
1037
|
+
def command_names; end
|
|
1038
|
+
end
|
|
1039
|
+
|
|
1040
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#37
|
|
1041
|
+
module CLI::Kit::CommandRegistry::NullContextualResolver
|
|
1042
|
+
extend ::CLI::Kit::CommandRegistry::ContextualResolver
|
|
1043
|
+
|
|
1044
|
+
class << self
|
|
1045
|
+
# : -> Hash[String, String]
|
|
1046
|
+
#
|
|
1047
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#49
|
|
1048
|
+
def aliases; end
|
|
1049
|
+
|
|
1050
|
+
# : (String _name) -> singleton(CLI::Kit::BaseCommand)
|
|
1051
|
+
#
|
|
1052
|
+
# @raise [CLI::Kit::Abort]
|
|
1053
|
+
#
|
|
1054
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#55
|
|
1055
|
+
def command_class(_name); end
|
|
1056
|
+
|
|
1057
|
+
# : -> Array[String]
|
|
1058
|
+
#
|
|
1059
|
+
# source://cli-kit//lib/cli/kit/command_registry.rb#43
|
|
1060
|
+
def command_names; end
|
|
1061
|
+
end
|
|
1062
|
+
end
|
|
1063
|
+
|
|
1064
|
+
# source://cli-kit//lib/cli/kit/config.rb#8
|
|
1065
|
+
class CLI::Kit::Config
|
|
1066
|
+
# : (tool_name: String) -> void
|
|
1067
|
+
#
|
|
1068
|
+
# @return [Config] a new instance of Config
|
|
1069
|
+
#
|
|
1070
|
+
# source://cli-kit//lib/cli/kit/config.rb#12
|
|
1071
|
+
def initialize(tool_name:); end
|
|
1072
|
+
|
|
1073
|
+
# The path on disk at which the configuration is stored:
|
|
1074
|
+
# `$XDG_CONFIG_HOME/<toolname>/config`
|
|
1075
|
+
# if ENV['XDG_CONFIG_HOME'] is not set, we default to ~/.config, e.g.:
|
|
1076
|
+
# ~/.config/tool/config
|
|
1077
|
+
#
|
|
1078
|
+
# : -> String
|
|
1079
|
+
#
|
|
1080
|
+
# source://cli-kit//lib/cli/kit/config.rb#110
|
|
1081
|
+
def file; end
|
|
1082
|
+
|
|
1083
|
+
# Returns the config corresponding to `name` from the config file
|
|
1084
|
+
# `false` is returned if it doesn't exist
|
|
1085
|
+
#
|
|
1086
|
+
# #### Parameters
|
|
1087
|
+
# `section` : the section of the config value you are looking for
|
|
1088
|
+
# `name` : the name of the config value you are looking for
|
|
1089
|
+
#
|
|
1090
|
+
# #### Returns
|
|
1091
|
+
# `value` : the value of the config variable (nil if none)
|
|
1092
|
+
#
|
|
1093
|
+
# #### Example Usage
|
|
1094
|
+
# `config.get('name.of.config')`
|
|
1095
|
+
#
|
|
1096
|
+
# : (String section, String name, ?default: String?) -> String?
|
|
1097
|
+
#
|
|
1098
|
+
# source://cli-kit//lib/cli/kit/config.rb#30
|
|
1099
|
+
def get(section, name, default: T.unsafe(nil)); end
|
|
1100
|
+
|
|
1101
|
+
# Coalesce and enforce the value of a config to a boolean
|
|
1102
|
+
# : (String section, String name, ?default: bool?) -> bool?
|
|
1103
|
+
#
|
|
1104
|
+
# source://cli-kit//lib/cli/kit/config.rb#36
|
|
1105
|
+
def get_bool(section, name, default: T.unsafe(nil)); end
|
|
1106
|
+
|
|
1107
|
+
# Gets the hash for the entire section
|
|
1108
|
+
#
|
|
1109
|
+
# #### Parameters
|
|
1110
|
+
# `section` : the section of the config you are getting
|
|
1111
|
+
#
|
|
1112
|
+
# #### Example Usage
|
|
1113
|
+
# `config.get_section('section')`
|
|
1114
|
+
#
|
|
1115
|
+
# : (String section) -> Hash[String, String]
|
|
1116
|
+
#
|
|
1117
|
+
# source://cli-kit//lib/cli/kit/config.rb#95
|
|
1118
|
+
def get_section(section); end
|
|
1119
|
+
|
|
1120
|
+
# Sets the config value in the config file
|
|
1121
|
+
#
|
|
1122
|
+
# #### Parameters
|
|
1123
|
+
# `section` : the section of the config you are setting
|
|
1124
|
+
# `name` : the name of the config you are setting
|
|
1125
|
+
# `value` : the value of the config you are setting
|
|
1126
|
+
#
|
|
1127
|
+
# #### Example Usage
|
|
1128
|
+
# `config.set('section', 'name.of.config', 'value')`
|
|
1129
|
+
#
|
|
1130
|
+
# : (String section, String name, (String | bool)? value) -> void
|
|
1131
|
+
#
|
|
1132
|
+
# source://cli-kit//lib/cli/kit/config.rb#60
|
|
1133
|
+
def set(section, name, value); end
|
|
1134
|
+
|
|
1135
|
+
# : -> String
|
|
1136
|
+
#
|
|
1137
|
+
# source://cli-kit//lib/cli/kit/config.rb#100
|
|
1138
|
+
def to_s; end
|
|
1139
|
+
|
|
1140
|
+
# Unsets a config value in the config file
|
|
1141
|
+
#
|
|
1142
|
+
# #### Parameters
|
|
1143
|
+
# `section` : the section of the config you are deleting
|
|
1144
|
+
# `name` : the name of the config you are deleting
|
|
1145
|
+
#
|
|
1146
|
+
# #### Example Usage
|
|
1147
|
+
# `config.unset('section', 'name.of.config')`
|
|
1148
|
+
#
|
|
1149
|
+
# : (String section, String name) -> void
|
|
1150
|
+
#
|
|
1151
|
+
# source://cli-kit//lib/cli/kit/config.rb#82
|
|
1152
|
+
def unset(section, name); end
|
|
1153
|
+
|
|
1154
|
+
private
|
|
1155
|
+
|
|
1156
|
+
# : -> Hash[String, Hash[String, String]]
|
|
1157
|
+
#
|
|
1158
|
+
# source://cli-kit//lib/cli/kit/config.rb#118
|
|
1159
|
+
def all_configs; end
|
|
1160
|
+
|
|
1161
|
+
# : -> CLI::Kit::Ini
|
|
1162
|
+
#
|
|
1163
|
+
# source://cli-kit//lib/cli/kit/config.rb#123
|
|
1164
|
+
def ini; end
|
|
1165
|
+
|
|
1166
|
+
# : -> void
|
|
1167
|
+
#
|
|
1168
|
+
# source://cli-kit//lib/cli/kit/config.rb#128
|
|
1169
|
+
def write_config; end
|
|
1170
|
+
end
|
|
1171
|
+
|
|
1172
|
+
# source://cli-kit//lib/cli/kit/config.rb#9
|
|
1173
|
+
CLI::Kit::Config::XDG_CONFIG_HOME = T.let(T.unsafe(nil), String)
|
|
1174
|
+
|
|
1175
|
+
# source://cli-kit//lib/cli/kit.rb#26
|
|
1176
|
+
CLI::Kit::EXIT_BUG = T.let(T.unsafe(nil), Integer)
|
|
1177
|
+
|
|
1178
|
+
# source://cli-kit//lib/cli/kit.rb#25
|
|
1179
|
+
CLI::Kit::EXIT_FAILURE_BUT_NOT_BUG = T.let(T.unsafe(nil), Integer)
|
|
1180
|
+
|
|
1181
|
+
# source://cli-kit//lib/cli/kit.rb#27
|
|
1182
|
+
CLI::Kit::EXIT_SUCCESS = T.let(T.unsafe(nil), Integer)
|
|
1183
|
+
|
|
1184
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#8
|
|
1185
|
+
class CLI::Kit::ErrorHandler
|
|
1186
|
+
# : (?log_file: String?, ?exception_reporter: exception_reporter_or_proc, ?tool_name: String?, ?dev_mode: bool) -> void
|
|
1187
|
+
#
|
|
1188
|
+
# @return [ErrorHandler] a new instance of ErrorHandler
|
|
1189
|
+
#
|
|
1190
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#15
|
|
1191
|
+
def initialize(log_file: T.unsafe(nil), exception_reporter: T.unsafe(nil), tool_name: T.unsafe(nil), dev_mode: T.unsafe(nil)); end
|
|
1192
|
+
|
|
1193
|
+
# : { -> void } -> Integer
|
|
1194
|
+
#
|
|
1195
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#44
|
|
1196
|
+
def call(&block); end
|
|
1197
|
+
|
|
1198
|
+
# : ^(Exception arg0) -> Integer
|
|
1199
|
+
#
|
|
1200
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#12
|
|
1201
|
+
def override_exception_handler=(_arg0); end
|
|
1202
|
+
|
|
1203
|
+
# : (Exception? error) -> void
|
|
1204
|
+
#
|
|
1205
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#52
|
|
1206
|
+
def report_exception(error); end
|
|
1207
|
+
|
|
1208
|
+
private
|
|
1209
|
+
|
|
1210
|
+
# : (Exception? error) -> Exception?
|
|
1211
|
+
#
|
|
1212
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#118
|
|
1213
|
+
def exception_for_submission(error); end
|
|
1214
|
+
|
|
1215
|
+
# : -> singleton(ExceptionReporter)
|
|
1216
|
+
#
|
|
1217
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#156
|
|
1218
|
+
def exception_reporter; end
|
|
1219
|
+
|
|
1220
|
+
# : (String message) -> void
|
|
1221
|
+
#
|
|
1222
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#149
|
|
1223
|
+
def stderr_puts(message); end
|
|
1224
|
+
|
|
1225
|
+
# Run the program, handling any errors that occur.
|
|
1226
|
+
#
|
|
1227
|
+
# Errors are printed to stderr unless they're #silent?, and are reported
|
|
1228
|
+
# to bugsnag (by setting @at_exit_exeption for our at_exit handler) if
|
|
1229
|
+
# they're #bug?
|
|
1230
|
+
#
|
|
1231
|
+
# Returns an exit status for the program.
|
|
1232
|
+
# : { -> void } -> Integer
|
|
1233
|
+
#
|
|
1234
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#80
|
|
1235
|
+
def triage_all_exceptions(&block); end
|
|
1236
|
+
end
|
|
1237
|
+
|
|
1238
|
+
# @abstract
|
|
1239
|
+
#
|
|
1240
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#23
|
|
1241
|
+
class CLI::Kit::ErrorHandler::ExceptionReporter
|
|
1242
|
+
class << self
|
|
1243
|
+
# : (Exception?, ?String?) -> void
|
|
1244
|
+
#
|
|
1245
|
+
# @abstract
|
|
1246
|
+
# @raise [NotImplementedError]
|
|
1247
|
+
#
|
|
1248
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#27
|
|
1249
|
+
def report(exception, logs = T.unsafe(nil)); end
|
|
1250
|
+
end
|
|
1251
|
+
end
|
|
1252
|
+
|
|
1253
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#33
|
|
1254
|
+
class CLI::Kit::ErrorHandler::NullExceptionReporter < ::CLI::Kit::ErrorHandler::ExceptionReporter
|
|
1255
|
+
class << self
|
|
1256
|
+
# : (Exception? _exception, ?String? _logs) -> void
|
|
1257
|
+
#
|
|
1258
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#37
|
|
1259
|
+
def report(_exception, _logs = T.unsafe(nil)); end
|
|
1260
|
+
end
|
|
1261
|
+
end
|
|
1262
|
+
|
|
1263
|
+
# source://cli-kit//lib/cli/kit/error_handler.rb#66
|
|
1264
|
+
CLI::Kit::ErrorHandler::SIGNALS_THAT_ARENT_BUGS = T.let(T.unsafe(nil), Array)
|
|
1265
|
+
|
|
1266
|
+
# source://cli-kit//lib/cli/kit/executor.rb#9
|
|
1267
|
+
class CLI::Kit::Executor
|
|
1268
|
+
# : (log_file: String) -> void
|
|
1269
|
+
#
|
|
1270
|
+
# @return [Executor] a new instance of Executor
|
|
1271
|
+
#
|
|
1272
|
+
# source://cli-kit//lib/cli/kit/executor.rb#11
|
|
1273
|
+
def initialize(log_file:); end
|
|
1274
|
+
|
|
1275
|
+
# : (singleton(CLI::Kit::BaseCommand) command, String command_name, Array[String] args) -> void
|
|
1276
|
+
#
|
|
1277
|
+
# source://cli-kit//lib/cli/kit/executor.rb#17
|
|
1278
|
+
def call(command, command_name, args); end
|
|
1279
|
+
|
|
1280
|
+
private
|
|
1281
|
+
|
|
1282
|
+
# : (untyped _sig) -> void
|
|
1283
|
+
#
|
|
1284
|
+
# source://cli-kit//lib/cli/kit/executor.rb#83
|
|
1285
|
+
def info_handler(_sig); end
|
|
1286
|
+
|
|
1287
|
+
# : (untyped _sig) -> void
|
|
1288
|
+
#
|
|
1289
|
+
# source://cli-kit//lib/cli/kit/executor.rb#73
|
|
1290
|
+
def quit_handler(_sig); end
|
|
1291
|
+
|
|
1292
|
+
# : [T] (String signal, Method handler) { -> T } -> T
|
|
1293
|
+
#
|
|
1294
|
+
# source://cli-kit//lib/cli/kit/executor.rb#54
|
|
1295
|
+
def twrap(signal, handler, &block); end
|
|
1296
|
+
|
|
1297
|
+
# : [T] { (String id) -> T } -> T
|
|
1298
|
+
#
|
|
1299
|
+
# source://cli-kit//lib/cli/kit/executor.rb#38
|
|
1300
|
+
def with_logging(&block); end
|
|
1301
|
+
|
|
1302
|
+
# : [T] { -> T } -> T
|
|
1303
|
+
#
|
|
1304
|
+
# source://cli-kit//lib/cli/kit/executor.rb#47
|
|
1305
|
+
def with_traps(&block); end
|
|
1306
|
+
end
|
|
1307
|
+
|
|
1308
|
+
# Abort, Bug, AbortSilent, and BugSilent are four ways of immediately bailing
|
|
1309
|
+
# on command-line execution when an unrecoverable error occurs.
|
|
1310
|
+
#
|
|
1311
|
+
# Note that these don't inherit from StandardError, and so are not caught by
|
|
1312
|
+
# a bare `rescue => e`.
|
|
1313
|
+
#
|
|
1314
|
+
# * Abort prints its message in red and exits 1;
|
|
1315
|
+
# * Bug additionally submits the exception to the exception_reporter passed to
|
|
1316
|
+
# `CLI::Kit::ErrorHandler.new`
|
|
1317
|
+
# * AbortSilent and BugSilent do the same as above, but do not print
|
|
1318
|
+
# messages before exiting.
|
|
1319
|
+
#
|
|
1320
|
+
# Treat these like panic() in Go:
|
|
1321
|
+
# * Don't rescue them. Use a different Exception class if you plan to recover;
|
|
1322
|
+
# * Provide a useful message, since it will be presented in brief to the
|
|
1323
|
+
# user, and will be useful for debugging.
|
|
1324
|
+
# * Avoid using it if it does actually make sense to recover from an error.
|
|
1325
|
+
#
|
|
1326
|
+
# Additionally:
|
|
1327
|
+
# * Do not subclass these.
|
|
1328
|
+
# * Only use AbortSilent or BugSilent if you prefer to print a more
|
|
1329
|
+
# contextualized error than Abort or Bug would present to the user.
|
|
1330
|
+
# * In general, don't attach a message to AbortSilent or BugSilent.
|
|
1331
|
+
# * Never raise GenericAbort directly.
|
|
1332
|
+
# * Think carefully about whether Abort or Bug is more appropriate. Is this
|
|
1333
|
+
# a bug in the tool? Or is it just user error, transient network
|
|
1334
|
+
# failure, etc.?
|
|
1335
|
+
# * One case where it's ok to rescue (cli-kit internals or tests aside):
|
|
1336
|
+
# 1. rescue Abort or Bug
|
|
1337
|
+
# 2. Print a contextualized error message
|
|
1338
|
+
# 3. Re-raise AbortSilent or BugSilent respectively.
|
|
1339
|
+
#
|
|
1340
|
+
# These aren't the only exceptions that can carry this 'bug' and 'silent'
|
|
1341
|
+
# metadata, however:
|
|
1342
|
+
#
|
|
1343
|
+
# If you raise an exception with `CLI::Kit.raise(..., bug: x, silent: y)`,
|
|
1344
|
+
# those last two (optional) keyword arguments will attach the metadata to
|
|
1345
|
+
# whatever exception you raise. This is interpreted later in the
|
|
1346
|
+
# ErrorHandler to decide how to print output and whether to submit the
|
|
1347
|
+
# exception to bugsnag.
|
|
1348
|
+
#
|
|
1349
|
+
# source://cli-kit//lib/cli/kit.rb#72
|
|
1350
|
+
class CLI::Kit::GenericAbort < ::Exception; end
|
|
1351
|
+
|
|
1352
|
+
# INI is a language similar to JSON or YAML, but simplied
|
|
1353
|
+
# The spec is here: https://en.wikipedia.org/wiki/INI_file
|
|
1354
|
+
# This parser includes supports for 2 very basic uses
|
|
1355
|
+
# - Sections
|
|
1356
|
+
# - Key Value Pairs (within and outside of the sections)
|
|
1357
|
+
#
|
|
1358
|
+
# [global]
|
|
1359
|
+
# key = val
|
|
1360
|
+
#
|
|
1361
|
+
# Nothing else is supported right now
|
|
1362
|
+
# See the ini_test.rb file for more examples
|
|
1363
|
+
#
|
|
1364
|
+
# source://cli-kit//lib/cli/kit/ini.rb#19
|
|
1365
|
+
class CLI::Kit::Ini
|
|
1366
|
+
# : (?String? path, ?config: String?, ?default_section: String) -> void
|
|
1367
|
+
#
|
|
1368
|
+
# @return [Ini] a new instance of Ini
|
|
1369
|
+
#
|
|
1370
|
+
# source://cli-kit//lib/cli/kit/ini.rb#24
|
|
1371
|
+
def initialize(path = T.unsafe(nil), config: T.unsafe(nil), default_section: T.unsafe(nil)); end
|
|
1372
|
+
|
|
1373
|
+
# : -> String
|
|
1374
|
+
#
|
|
1375
|
+
# source://cli-kit//lib/cli/kit/ini.rb#53
|
|
1376
|
+
def git_format; end
|
|
1377
|
+
|
|
1378
|
+
# : Hash[String, Hash[String, String]]
|
|
1379
|
+
#
|
|
1380
|
+
# source://cli-kit//lib/cli/kit/ini.rb#21
|
|
1381
|
+
def ini; end
|
|
1382
|
+
|
|
1383
|
+
# : Hash[String, Hash[String, String]]
|
|
1384
|
+
#
|
|
1385
|
+
# source://cli-kit//lib/cli/kit/ini.rb#21
|
|
1386
|
+
def ini=(_arg0); end
|
|
1387
|
+
|
|
1388
|
+
# : -> Hash[String, Hash[String, String]]
|
|
1389
|
+
#
|
|
1390
|
+
# source://cli-kit//lib/cli/kit/ini.rb#35
|
|
1391
|
+
def parse; end
|
|
1392
|
+
|
|
1393
|
+
# : -> String
|
|
1394
|
+
#
|
|
1395
|
+
# source://cli-kit//lib/cli/kit/ini.rb#58
|
|
1396
|
+
def to_s; end
|
|
1397
|
+
|
|
1398
|
+
private
|
|
1399
|
+
|
|
1400
|
+
# : (String k) -> bool
|
|
1401
|
+
#
|
|
1402
|
+
# @return [Boolean]
|
|
1403
|
+
#
|
|
1404
|
+
# source://cli-kit//lib/cli/kit/ini.rb#86
|
|
1405
|
+
def section_designator?(k); end
|
|
1406
|
+
|
|
1407
|
+
# : (String key, String val) -> void
|
|
1408
|
+
#
|
|
1409
|
+
# source://cli-kit//lib/cli/kit/ini.rb#79
|
|
1410
|
+
def set_val(key, val); end
|
|
1411
|
+
|
|
1412
|
+
# : (?git_format: bool) -> String
|
|
1413
|
+
#
|
|
1414
|
+
# source://cli-kit//lib/cli/kit/ini.rb#65
|
|
1415
|
+
def to_ini(git_format: T.unsafe(nil)); end
|
|
1416
|
+
end
|
|
1417
|
+
|
|
1418
|
+
# source://cli-kit//lib/cli/kit/levenshtein.rb#30
|
|
1419
|
+
module CLI::Kit::Levenshtein
|
|
1420
|
+
private
|
|
1421
|
+
|
|
1422
|
+
# source://cli-kit//lib/cli/kit/levenshtein.rb#38
|
|
1423
|
+
def distance(str1, str2); end
|
|
1424
|
+
|
|
1425
|
+
# detects the minimum value out of three arguments. This method is
|
|
1426
|
+
# faster than `[a, b, c].min` and puts less GC pressure.
|
|
1427
|
+
# See https://github.com/yuki24/did_you_mean/pull/1 for a performance
|
|
1428
|
+
# benchmark.
|
|
1429
|
+
# : (Integer a, Integer b, Integer c) -> Integer
|
|
1430
|
+
#
|
|
1431
|
+
# source://cli-kit//lib/cli/kit/levenshtein.rb#80
|
|
1432
|
+
def min3(a, b, c); end
|
|
1433
|
+
|
|
1434
|
+
class << self
|
|
1435
|
+
# source://cli-kit//lib/cli/kit/levenshtein.rb#38
|
|
1436
|
+
def distance(str1, str2); end
|
|
1437
|
+
|
|
1438
|
+
# detects the minimum value out of three arguments. This method is
|
|
1439
|
+
# faster than `[a, b, c].min` and puts less GC pressure.
|
|
1440
|
+
# See https://github.com/yuki24/did_you_mean/pull/1 for a performance
|
|
1441
|
+
# benchmark.
|
|
1442
|
+
# : (Integer a, Integer b, Integer c) -> Integer
|
|
1443
|
+
#
|
|
1444
|
+
# source://cli-kit//lib/cli/kit/levenshtein.rb#80
|
|
1445
|
+
def min3(a, b, c); end
|
|
1446
|
+
end
|
|
1447
|
+
end
|
|
1448
|
+
|
|
1449
|
+
# source://cli-kit//lib/cli/kit/logger.rb#9
|
|
1450
|
+
class CLI::Kit::Logger
|
|
1451
|
+
# Constructor for CLI::Kit::Logger
|
|
1452
|
+
#
|
|
1453
|
+
# : (debug_log_file: String, ?env_debug_name: String) -> void
|
|
1454
|
+
#
|
|
1455
|
+
# @param debug_log_file [String] path to the file where debug logs should be stored
|
|
1456
|
+
# @return [Logger] a new instance of Logger
|
|
1457
|
+
#
|
|
1458
|
+
# source://cli-kit//lib/cli/kit/logger.rb#17
|
|
1459
|
+
def initialize(debug_log_file:, env_debug_name: T.unsafe(nil)); end
|
|
1460
|
+
|
|
1461
|
+
# Similar to Logger#debug, however will not output to STDOUT unless DEBUG env var is set
|
|
1462
|
+
# Logs to the debug file, taking into account CLI::UI::StdoutRouter.current_id
|
|
1463
|
+
#
|
|
1464
|
+
# : (String msg) -> void
|
|
1465
|
+
#
|
|
1466
|
+
# @param msg [String] the message to log
|
|
1467
|
+
#
|
|
1468
|
+
# source://cli-kit//lib/cli/kit/logger.rb#72
|
|
1469
|
+
def debug(msg); end
|
|
1470
|
+
|
|
1471
|
+
# Functionally equivalent to Logger#error
|
|
1472
|
+
# Also logs to the debug file, taking into account CLI::UI::StdoutRouter.current_id
|
|
1473
|
+
#
|
|
1474
|
+
# : (String msg, ?debug: bool) -> void
|
|
1475
|
+
#
|
|
1476
|
+
# @param msg [String] the message to log
|
|
1477
|
+
# @param debug [Boolean] determines if the debug logger will receive the log (default true)
|
|
1478
|
+
#
|
|
1479
|
+
# source://cli-kit//lib/cli/kit/logger.rb#51
|
|
1480
|
+
def error(msg, debug: T.unsafe(nil)); end
|
|
1481
|
+
|
|
1482
|
+
# Functionally equivalent to Logger#fatal
|
|
1483
|
+
# Also logs to the debug file, taking into account CLI::UI::StdoutRouter.current_id
|
|
1484
|
+
#
|
|
1485
|
+
# : (String msg, ?debug: bool) -> void
|
|
1486
|
+
#
|
|
1487
|
+
# @param msg [String] the message to log
|
|
1488
|
+
# @param debug [Boolean] determines if the debug logger will receive the log (default true)
|
|
1489
|
+
#
|
|
1490
|
+
# source://cli-kit//lib/cli/kit/logger.rb#62
|
|
1491
|
+
def fatal(msg, debug: T.unsafe(nil)); end
|
|
1492
|
+
|
|
1493
|
+
# Functionally equivalent to Logger#info
|
|
1494
|
+
# Also logs to the debug file, taking into account CLI::UI::StdoutRouter.current_id
|
|
1495
|
+
#
|
|
1496
|
+
# : (String msg, ?debug: bool) -> void
|
|
1497
|
+
#
|
|
1498
|
+
# @param msg [String] the message to log
|
|
1499
|
+
# @param debug [Boolean] determines if the debug logger will receive the log (default true)
|
|
1500
|
+
#
|
|
1501
|
+
# source://cli-kit//lib/cli/kit/logger.rb#29
|
|
1502
|
+
def info(msg, debug: T.unsafe(nil)); end
|
|
1503
|
+
|
|
1504
|
+
# Functionally equivalent to Logger#warn
|
|
1505
|
+
# Also logs to the debug file, taking into account CLI::UI::StdoutRouter.current_id
|
|
1506
|
+
#
|
|
1507
|
+
# : (String msg, ?debug: bool) -> void
|
|
1508
|
+
#
|
|
1509
|
+
# @param msg [String] the message to log
|
|
1510
|
+
# @param debug [Boolean] determines if the debug logger will receive the log (default true)
|
|
1511
|
+
#
|
|
1512
|
+
# source://cli-kit//lib/cli/kit/logger.rb#40
|
|
1513
|
+
def warn(msg, debug: T.unsafe(nil)); end
|
|
1514
|
+
|
|
1515
|
+
private
|
|
1516
|
+
|
|
1517
|
+
# : -> bool
|
|
1518
|
+
#
|
|
1519
|
+
# @return [Boolean]
|
|
1520
|
+
#
|
|
1521
|
+
# source://cli-kit//lib/cli/kit/logger.rb#88
|
|
1522
|
+
def debug?; end
|
|
1523
|
+
|
|
1524
|
+
# : (String msg) -> String
|
|
1525
|
+
#
|
|
1526
|
+
# source://cli-kit//lib/cli/kit/logger.rb#80
|
|
1527
|
+
def format_debug(msg); end
|
|
1528
|
+
end
|
|
1529
|
+
|
|
1530
|
+
# 5MB
|
|
1531
|
+
#
|
|
1532
|
+
# source://cli-kit//lib/cli/kit/logger.rb#10
|
|
1533
|
+
CLI::Kit::Logger::MAX_LOG_SIZE = T.let(T.unsafe(nil), Integer)
|
|
1534
|
+
|
|
1535
|
+
# source://cli-kit//lib/cli/kit/logger.rb#11
|
|
1536
|
+
CLI::Kit::Logger::MAX_NUM_LOGS = T.let(T.unsafe(nil), Integer)
|
|
1537
|
+
|
|
1538
|
+
# source://cli-kit//lib/cli/kit/opts.rb#7
|
|
1539
|
+
class CLI::Kit::Opts
|
|
1540
|
+
include ::CLI::Kit::Opts::Mixin
|
|
1541
|
+
extend ::CLI::Kit::Opts::Mixin::MixinClassMethods
|
|
1542
|
+
|
|
1543
|
+
# : (String name) -> (String | bool)?
|
|
1544
|
+
#
|
|
1545
|
+
# source://cli-kit//lib/cli/kit/opts.rb#196
|
|
1546
|
+
def [](name); end
|
|
1547
|
+
|
|
1548
|
+
# : -> Args::Evaluation
|
|
1549
|
+
#
|
|
1550
|
+
# @raise [NotImplementedError]
|
|
1551
|
+
#
|
|
1552
|
+
# source://cli-kit//lib/cli/kit/opts.rb#223
|
|
1553
|
+
def assert_result!; end
|
|
1554
|
+
|
|
1555
|
+
# : (Args::Definition defn) -> void
|
|
1556
|
+
#
|
|
1557
|
+
# source://cli-kit//lib/cli/kit/opts.rb#230
|
|
1558
|
+
def define!(defn); end
|
|
1559
|
+
|
|
1560
|
+
# : ?{ (Symbol arg0, bool arg1) -> void } -> untyped
|
|
1561
|
+
#
|
|
1562
|
+
# source://cli-kit//lib/cli/kit/opts.rb#184
|
|
1563
|
+
def each_flag(&block); end
|
|
1564
|
+
|
|
1565
|
+
# : ?{ (Symbol arg0, String? arg1) -> void } -> untyped
|
|
1566
|
+
#
|
|
1567
|
+
# source://cli-kit//lib/cli/kit/opts.rb#172
|
|
1568
|
+
def each_option(&block); end
|
|
1569
|
+
|
|
1570
|
+
# : (Args::Evaluation ev) -> void
|
|
1571
|
+
#
|
|
1572
|
+
# source://cli-kit//lib/cli/kit/opts.rb#242
|
|
1573
|
+
def evaluate!(ev); end
|
|
1574
|
+
|
|
1575
|
+
# : -> bool
|
|
1576
|
+
#
|
|
1577
|
+
# source://cli-kit//lib/cli/kit/opts.rb#161
|
|
1578
|
+
def helpflag; end
|
|
1579
|
+
|
|
1580
|
+
# : (String name) -> bool
|
|
1581
|
+
#
|
|
1582
|
+
# source://cli-kit//lib/cli/kit/opts.rb#215
|
|
1583
|
+
def lookup_flag(name); end
|
|
1584
|
+
|
|
1585
|
+
# : (String name) -> String?
|
|
1586
|
+
#
|
|
1587
|
+
# source://cli-kit//lib/cli/kit/opts.rb#206
|
|
1588
|
+
def lookup_option(name); end
|
|
1589
|
+
|
|
1590
|
+
# : -> Array[String]
|
|
1591
|
+
#
|
|
1592
|
+
# source://cli-kit//lib/cli/kit/opts.rb#166
|
|
1593
|
+
def unparsed; end
|
|
1594
|
+
end
|
|
1595
|
+
|
|
1596
|
+
# source://cli-kit//lib/cli/kit/opts.rb#158
|
|
1597
|
+
CLI::Kit::Opts::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Array)
|
|
1598
|
+
|
|
1599
|
+
# source://cli-kit//lib/cli/kit/opts.rb#8
|
|
1600
|
+
module CLI::Kit::Opts::Mixin
|
|
1601
|
+
include ::Kernel
|
|
1602
|
+
|
|
1603
|
+
mixes_in_class_methods ::CLI::Kit::Opts::Mixin::MixinClassMethods
|
|
1604
|
+
|
|
1605
|
+
# : (?name: Symbol, ?short: String?, ?long: String?, ?desc: String?) -> bool
|
|
1606
|
+
#
|
|
1607
|
+
# source://cli-kit//lib/cli/kit/opts.rb#89
|
|
1608
|
+
def flag(name: T.unsafe(nil), short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil)); end
|
|
1609
|
+
|
|
1610
|
+
# : (?name: Symbol, ?short: String?, ?long: String?, ?desc: String?, ?default: (Array[String] | ^-> Array[String])) -> Array[String]
|
|
1611
|
+
#
|
|
1612
|
+
# source://cli-kit//lib/cli/kit/opts.rb#76
|
|
1613
|
+
def multi_option(name: T.unsafe(nil), short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil), default: T.unsafe(nil)); end
|
|
1614
|
+
|
|
1615
|
+
# : (?name: Symbol, ?short: String?, ?long: String?, ?desc: String?, ?default: (String | ^-> String)?) -> String?
|
|
1616
|
+
#
|
|
1617
|
+
# source://cli-kit//lib/cli/kit/opts.rb#46
|
|
1618
|
+
def option(name: T.unsafe(nil), short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil), default: T.unsafe(nil)); end
|
|
1619
|
+
|
|
1620
|
+
# : (?name: Symbol, ?short: String?, ?long: String?, ?desc: String?, ?default: (String | ^-> String)?) -> String
|
|
1621
|
+
#
|
|
1622
|
+
# source://cli-kit//lib/cli/kit/opts.rb#63
|
|
1623
|
+
def option!(name: T.unsafe(nil), short: T.unsafe(nil), long: T.unsafe(nil), desc: T.unsafe(nil), default: T.unsafe(nil)); end
|
|
1624
|
+
|
|
1625
|
+
# : (?name: Symbol, ?desc: String?, ?default: (String | ^-> String)?, ?skip: (^-> bool | ^(String arg0) -> bool)?) -> String?
|
|
1626
|
+
#
|
|
1627
|
+
# source://cli-kit//lib/cli/kit/opts.rb#111
|
|
1628
|
+
def position(name: T.unsafe(nil), desc: T.unsafe(nil), default: T.unsafe(nil), skip: T.unsafe(nil)); end
|
|
1629
|
+
|
|
1630
|
+
# : (?name: Symbol, ?desc: String?) -> String
|
|
1631
|
+
#
|
|
1632
|
+
# source://cli-kit//lib/cli/kit/opts.rb#100
|
|
1633
|
+
def position!(name: T.unsafe(nil), desc: T.unsafe(nil)); end
|
|
1634
|
+
|
|
1635
|
+
# : (?name: Symbol, ?desc: String?) -> Array[String]
|
|
1636
|
+
#
|
|
1637
|
+
# source://cli-kit//lib/cli/kit/opts.rb#122
|
|
1638
|
+
def rest(name: T.unsafe(nil), desc: T.unsafe(nil)); end
|
|
1639
|
+
|
|
1640
|
+
private
|
|
1641
|
+
|
|
1642
|
+
# : -> Symbol
|
|
1643
|
+
#
|
|
1644
|
+
# @raise [ArgumentError]
|
|
1645
|
+
#
|
|
1646
|
+
# source://cli-kit//lib/cli/kit/opts.rb#142
|
|
1647
|
+
def infer_name; end
|
|
1648
|
+
|
|
1649
|
+
# : (String? label) -> Symbol?
|
|
1650
|
+
#
|
|
1651
|
+
# source://cli-kit//lib/cli/kit/opts.rb#135
|
|
1652
|
+
def symbolize(label); end
|
|
1653
|
+
|
|
1654
|
+
class << self
|
|
1655
|
+
# : (Module klass) -> void
|
|
1656
|
+
#
|
|
1657
|
+
# source://cli-kit//lib/cli/kit/opts.rb#40
|
|
1658
|
+
def included(klass); end
|
|
1659
|
+
end
|
|
1660
|
+
end
|
|
1661
|
+
|
|
1662
|
+
# source://cli-kit//lib/cli/kit/opts.rb#11
|
|
1663
|
+
module CLI::Kit::Opts::Mixin::MixinClassMethods
|
|
1664
|
+
# : (Module included_module) -> void
|
|
1665
|
+
#
|
|
1666
|
+
# source://cli-kit//lib/cli/kit/opts.rb#13
|
|
1667
|
+
def include(included_module); end
|
|
1668
|
+
|
|
1669
|
+
# No signature - Sorbet uses method_added internally, so can't verify it
|
|
1670
|
+
#
|
|
1671
|
+
# source://cli-kit//lib/cli/kit/opts.rb#21
|
|
1672
|
+
def method_added(method_name); end
|
|
1673
|
+
|
|
1674
|
+
# : (Symbol method_name) -> void
|
|
1675
|
+
#
|
|
1676
|
+
# source://cli-kit//lib/cli/kit/opts.rb#27
|
|
1677
|
+
def track_method(method_name); end
|
|
1678
|
+
|
|
1679
|
+
# : -> Array[Symbol]
|
|
1680
|
+
#
|
|
1681
|
+
# source://cli-kit//lib/cli/kit/opts.rb#33
|
|
1682
|
+
def tracked_methods; end
|
|
1683
|
+
end
|
|
1684
|
+
|
|
1685
|
+
# source://cli-kit//lib/cli/kit/parse_args.rb#5
|
|
1686
|
+
module CLI::Kit::ParseArgs
|
|
1687
|
+
include ::Kernel
|
|
1688
|
+
|
|
1689
|
+
# : ((Array | String) args, Hash[Symbol, Array[untyped]] opts_defn) -> Hash[Symbol, untyped]
|
|
1690
|
+
#
|
|
1691
|
+
# source://cli-kit//lib/cli/kit/parse_args.rb#15
|
|
1692
|
+
def parse_args(args, opts_defn); end
|
|
1693
|
+
end
|
|
1694
|
+
|
|
1695
|
+
# source://cli-kit//lib/cli/kit/resolver.rb#7
|
|
1696
|
+
class CLI::Kit::Resolver
|
|
1697
|
+
# : (tool_name: String, command_registry: CLI::Kit::CommandRegistry) -> void
|
|
1698
|
+
#
|
|
1699
|
+
# @return [Resolver] a new instance of Resolver
|
|
1700
|
+
#
|
|
1701
|
+
# source://cli-kit//lib/cli/kit/resolver.rb#9
|
|
1702
|
+
def initialize(tool_name:, command_registry:); end
|
|
1703
|
+
|
|
1704
|
+
# : (Array[String] args) -> [singleton(CLI::Kit::BaseCommand), String, Array[String]]
|
|
1705
|
+
#
|
|
1706
|
+
# source://cli-kit//lib/cli/kit/resolver.rb#15
|
|
1707
|
+
def call(args); end
|
|
1708
|
+
|
|
1709
|
+
private
|
|
1710
|
+
|
|
1711
|
+
# : (String? name) -> void
|
|
1712
|
+
#
|
|
1713
|
+
# source://cli-kit//lib/cli/kit/resolver.rb#32
|
|
1714
|
+
def command_not_found(name); end
|
|
1715
|
+
|
|
1716
|
+
# : -> Array[String]
|
|
1717
|
+
#
|
|
1718
|
+
# source://cli-kit//lib/cli/kit/resolver.rb#61
|
|
1719
|
+
def commands_and_aliases; end
|
|
1720
|
+
end
|
|
1721
|
+
|
|
1722
|
+
# source://cli-kit//lib/cli/kit/support.rb#7
|
|
1723
|
+
module CLI::Kit::Support; end
|
|
1724
|
+
|
|
1725
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#6
|
|
1726
|
+
module CLI::Kit::Support::TestHelper
|
|
1727
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#12
|
|
1728
|
+
def assert_all_commands_run(should_raise: T.unsafe(nil)); end
|
|
1729
|
+
|
|
1730
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#7
|
|
1731
|
+
def setup; end
|
|
1732
|
+
|
|
1733
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#22
|
|
1734
|
+
def teardown; end
|
|
1735
|
+
end
|
|
1736
|
+
|
|
1737
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#29
|
|
1738
|
+
module CLI::Kit::Support::TestHelper::FakeConfig
|
|
1739
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#33
|
|
1740
|
+
def setup; end
|
|
1741
|
+
|
|
1742
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#40
|
|
1743
|
+
def teardown; end
|
|
1744
|
+
end
|
|
1745
|
+
|
|
1746
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#47
|
|
1747
|
+
class CLI::Kit::Support::TestHelper::FakeSuccess
|
|
1748
|
+
# @return [FakeSuccess] a new instance of FakeSuccess
|
|
1749
|
+
#
|
|
1750
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#48
|
|
1751
|
+
def initialize(success); end
|
|
1752
|
+
|
|
1753
|
+
# @return [Boolean]
|
|
1754
|
+
#
|
|
1755
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#52
|
|
1756
|
+
def success?; end
|
|
1757
|
+
end
|
|
1758
|
+
|
|
1759
|
+
# source://cli-kit//lib/cli/kit/system.rb#9
|
|
1760
|
+
module CLI::Kit::System
|
|
1761
|
+
class << self
|
|
1762
|
+
# Execute a command in the user's environment
|
|
1763
|
+
# This is meant to be largely equivalent to backticks, only with the env passed in.
|
|
1764
|
+
# Captures the results of the command without output to the console
|
|
1765
|
+
#
|
|
1766
|
+
# #### Parameters
|
|
1767
|
+
# - `*a`: A splat of arguments evaluated as a command. (e.g. `'rm', folder` is equivalent to `rm #{folder}`)
|
|
1768
|
+
# - `sudo`: If truthy, run this command with sudo. If String, pass to `sudo_reason`
|
|
1769
|
+
# - `env`: process environment with which to execute this command
|
|
1770
|
+
# - `**kwargs`: additional arguments to pass to Open3.capture2
|
|
1771
|
+
#
|
|
1772
|
+
# #### Returns
|
|
1773
|
+
# - `output`: output (STDOUT) of the command execution
|
|
1774
|
+
# - `status`: boolean success status of the command execution
|
|
1775
|
+
#
|
|
1776
|
+
# #### Usage
|
|
1777
|
+
# `out, stat = CLI::Kit::System.capture2('ls', 'a_folder')`
|
|
1778
|
+
#
|
|
1779
|
+
# : (String cmd, *String args, ?sudo: (String | bool), ?env: Hash[String, String?], **untyped kwargs) -> [String, Process::Status]
|
|
1780
|
+
#
|
|
1781
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#79
|
|
1782
|
+
def capture2(cmd, *a, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs); end
|
|
1783
|
+
|
|
1784
|
+
# Execute a command in the user's environment
|
|
1785
|
+
# This is meant to be largely equivalent to backticks, only with the env passed in.
|
|
1786
|
+
# Captures the results of the command without output to the console
|
|
1787
|
+
#
|
|
1788
|
+
# #### Parameters
|
|
1789
|
+
# - `*a`: A splat of arguments evaluated as a command. (e.g. `'rm', folder` is equivalent to `rm #{folder}`)
|
|
1790
|
+
# - `sudo`: If truthy, run this command with sudo. If String, pass to `sudo_reason`
|
|
1791
|
+
# - `env`: process environment with which to execute this command
|
|
1792
|
+
# - `**kwargs`: additional arguments to pass to Open3.capture2e
|
|
1793
|
+
#
|
|
1794
|
+
# #### Returns
|
|
1795
|
+
# - `output`: output (STDOUT merged with STDERR) of the command execution
|
|
1796
|
+
# - `status`: boolean success status of the command execution
|
|
1797
|
+
#
|
|
1798
|
+
# #### Usage
|
|
1799
|
+
# `out_and_err, stat = CLI::Kit::System.capture2e('ls', 'a_folder')`
|
|
1800
|
+
#
|
|
1801
|
+
# : (String cmd, *String args, ?sudo: (String | bool), ?env: Hash[String, String?], **untyped kwargs) -> [String, Process::Status]
|
|
1802
|
+
#
|
|
1803
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#99
|
|
1804
|
+
def capture2e(cmd, *a, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs); end
|
|
1805
|
+
|
|
1806
|
+
# Execute a command in the user's environment
|
|
1807
|
+
# This is meant to be largely equivalent to backticks, only with the env passed in.
|
|
1808
|
+
# Captures the results of the command without output to the console
|
|
1809
|
+
#
|
|
1810
|
+
# #### Parameters
|
|
1811
|
+
# - `*a`: A splat of arguments evaluated as a command. (e.g. `'rm', folder` is equivalent to `rm #{folder}`)
|
|
1812
|
+
# - `sudo`: If truthy, run this command with sudo. If String, pass to `sudo_reason`
|
|
1813
|
+
# - `env`: process environment with which to execute this command
|
|
1814
|
+
# - `**kwargs`: additional arguments to pass to Open3.capture3
|
|
1815
|
+
#
|
|
1816
|
+
# #### Returns
|
|
1817
|
+
# - `output`: STDOUT of the command execution
|
|
1818
|
+
# - `error`: STDERR of the command execution
|
|
1819
|
+
# - `status`: boolean success status of the command execution
|
|
1820
|
+
#
|
|
1821
|
+
# #### Usage
|
|
1822
|
+
# `out, err, stat = CLI::Kit::System.capture3('ls', 'a_folder')`
|
|
1823
|
+
#
|
|
1824
|
+
# : (String cmd, *String args, ?sudo: (String | bool), ?env: Hash[String, String?], **untyped kwargs) -> [String, String, Process::Status]
|
|
1825
|
+
#
|
|
1826
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#119
|
|
1827
|
+
def capture3(cmd, *a, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs); end
|
|
1828
|
+
|
|
1829
|
+
# Returns the errors associated to a test run
|
|
1830
|
+
#
|
|
1831
|
+
# #### Returns
|
|
1832
|
+
# `errors` (String) a string representing errors found on this run, nil if none
|
|
1833
|
+
#
|
|
1834
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#183
|
|
1835
|
+
def error_message; end
|
|
1836
|
+
|
|
1837
|
+
# Sets up an expectation for a command and stubs out the call (unless allow is true)
|
|
1838
|
+
#
|
|
1839
|
+
# #### Parameters
|
|
1840
|
+
# `*a` : the command, represented as a splat
|
|
1841
|
+
# `stdout` : stdout to stub the command with (defaults to empty string)
|
|
1842
|
+
# `stderr` : stderr to stub the command with (defaults to empty string)
|
|
1843
|
+
# `allow` : allow determines if the command will be actually run, or stubbed. Defaults to nil (stub)
|
|
1844
|
+
# `success` : success status to stub the command with (Defaults to nil)
|
|
1845
|
+
# `sudo` : expectation of sudo being set or not (defaults to false)
|
|
1846
|
+
# `env` : expectation of env being set or not (defaults to {})
|
|
1847
|
+
#
|
|
1848
|
+
# Note: Must set allow or success
|
|
1849
|
+
#
|
|
1850
|
+
# @raise [ArgumentError]
|
|
1851
|
+
#
|
|
1852
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#152
|
|
1853
|
+
def fake(*a, stdout: T.unsafe(nil), stderr: T.unsafe(nil), allow: T.unsafe(nil), success: T.unsafe(nil), sudo: T.unsafe(nil), env: T.unsafe(nil)); end
|
|
1854
|
+
|
|
1855
|
+
# source://cli-kit//lib/cli/kit/system.rb#50
|
|
1856
|
+
def original_capture2(cmd, *args, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs); end
|
|
1857
|
+
|
|
1858
|
+
# source://cli-kit//lib/cli/kit/system.rb#72
|
|
1859
|
+
def original_capture2e(cmd, *args, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs); end
|
|
1860
|
+
|
|
1861
|
+
# source://cli-kit//lib/cli/kit/system.rb#95
|
|
1862
|
+
def original_capture3(cmd, *args, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs); end
|
|
1863
|
+
|
|
1864
|
+
# source://cli-kit//lib/cli/kit/system.rb#130
|
|
1865
|
+
def original_system(cmd, *args, sudo: T.unsafe(nil), env: T.unsafe(nil), stdin: T.unsafe(nil), **kwargs, &block); end
|
|
1866
|
+
|
|
1867
|
+
# : -> Symbol
|
|
1868
|
+
#
|
|
1869
|
+
# source://cli-kit//lib/cli/kit/system.rb#226
|
|
1870
|
+
def os; end
|
|
1871
|
+
|
|
1872
|
+
# : (String cmd, *String args, ?sudo: (String | bool), ?env: Hash[String, String?], **untyped kwargs) ?{ (IO stdin, IO stdout, Process::Waiter wait_thr) -> [IO, IO, Process::Waiter] } -> [IO, IO, Process::Waiter]
|
|
1873
|
+
#
|
|
1874
|
+
# source://cli-kit//lib/cli/kit/system.rb#100
|
|
1875
|
+
def popen2(cmd, *args, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs, &block); end
|
|
1876
|
+
|
|
1877
|
+
# : (String cmd, *String args, ?sudo: (String | bool), ?env: Hash[String, String?], **untyped kwargs) ?{ (IO stdin, IO stdout, Process::Waiter wait_thr) -> [IO, IO, Process::Waiter] } -> [IO, IO, Process::Waiter]
|
|
1878
|
+
#
|
|
1879
|
+
# source://cli-kit//lib/cli/kit/system.rb#105
|
|
1880
|
+
def popen2e(cmd, *args, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs, &block); end
|
|
1881
|
+
|
|
1882
|
+
# : (String cmd, *String args, ?sudo: (String | bool), ?env: Hash[String, String?], **untyped kwargs) ?{ (IO stdin, IO stdout, IO stderr, Process::Waiter wait_thr) -> [IO, IO, IO, Process::Waiter] } -> [IO, IO, IO, Process::Waiter]
|
|
1883
|
+
#
|
|
1884
|
+
# source://cli-kit//lib/cli/kit/system.rb#110
|
|
1885
|
+
def popen3(cmd, *args, sudo: T.unsafe(nil), env: T.unsafe(nil), **kwargs, &block); end
|
|
1886
|
+
|
|
1887
|
+
# Resets the faked commands
|
|
1888
|
+
#
|
|
1889
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#175
|
|
1890
|
+
def reset!; end
|
|
1891
|
+
|
|
1892
|
+
# Split off trailing partial UTF-8 Characters. UTF-8 Multibyte characters start with a 11xxxxxx byte that tells
|
|
1893
|
+
# how many following bytes are part of this character, followed by some number of 10xxxxxx bytes. This simple
|
|
1894
|
+
# algorithm will split off a whole trailing multi-byte character.
|
|
1895
|
+
# : (String data) -> [String, String]
|
|
1896
|
+
#
|
|
1897
|
+
# source://cli-kit//lib/cli/kit/system.rb#186
|
|
1898
|
+
def split_partial_characters(data); end
|
|
1899
|
+
|
|
1900
|
+
# Ask for sudo access with a message explaning the need for it
|
|
1901
|
+
# Will make subsequent commands capable of running with sudo for a period of time
|
|
1902
|
+
#
|
|
1903
|
+
# #### Parameters
|
|
1904
|
+
# - `msg`: A message telling the user why sudo is needed
|
|
1905
|
+
#
|
|
1906
|
+
# #### Usage
|
|
1907
|
+
# `ctx.sudo_reason("We need to do a thing")`
|
|
1908
|
+
#
|
|
1909
|
+
# : (String msg) -> void
|
|
1910
|
+
#
|
|
1911
|
+
# source://cli-kit//lib/cli/kit/system.rb#22
|
|
1912
|
+
def sudo_reason(msg); end
|
|
1913
|
+
|
|
1914
|
+
# Execute a command in the user's environment
|
|
1915
|
+
# Outputs result of the command without capturing it
|
|
1916
|
+
#
|
|
1917
|
+
# #### Parameters
|
|
1918
|
+
# - `*a`: A splat of arguments evaluated as a command. (e.g. `'rm', folder` is equivalent to `rm #{folder}`)
|
|
1919
|
+
# - `sudo`: If truthy, run this command with sudo. If String, pass to `sudo_reason`
|
|
1920
|
+
# - `env`: process environment with which to execute this command
|
|
1921
|
+
# - `**kwargs`: additional keyword arguments to pass to Process.spawn
|
|
1922
|
+
#
|
|
1923
|
+
# #### Returns
|
|
1924
|
+
# - `status`: The `Process:Status` result for the command execution
|
|
1925
|
+
#
|
|
1926
|
+
# #### Usage
|
|
1927
|
+
# `stat = CLI::Kit::System.system('ls', 'a_folder')`
|
|
1928
|
+
#
|
|
1929
|
+
# : (String cmd, *String args, ?sudo: (String | bool), ?env: Hash[String, String?], ?stdin: (IO | String | Integer | Symbol)?, **untyped kwargs) ?{ (String out, String err) -> void } -> Process::Status
|
|
1930
|
+
#
|
|
1931
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#62
|
|
1932
|
+
def system(cmd, *a, sudo: T.unsafe(nil), env: T.unsafe(nil), stdin: T.unsafe(nil), **kwargs); end
|
|
1933
|
+
|
|
1934
|
+
# : (String cmd, Hash[String, String?] env) -> String?
|
|
1935
|
+
#
|
|
1936
|
+
# source://cli-kit//lib/cli/kit/system.rb#235
|
|
1937
|
+
def which(cmd, env); end
|
|
1938
|
+
|
|
1939
|
+
private
|
|
1940
|
+
|
|
1941
|
+
# : (String cmd, Array[String] args, (String | bool) sudo) -> [String, Array[String]]
|
|
1942
|
+
#
|
|
1943
|
+
# source://cli-kit//lib/cli/kit/system.rb#250
|
|
1944
|
+
def apply_sudo(cmd, args, sudo); end
|
|
1945
|
+
|
|
1946
|
+
# : (String cmd, Array[String] args, Hash[Symbol, untyped] kwargs, ?sudo: (String | bool), ?env: Hash[String, String?], ?method: Symbol) ?{ (?) -> untyped } -> untyped
|
|
1947
|
+
#
|
|
1948
|
+
# source://cli-kit//lib/cli/kit/system.rb#258
|
|
1949
|
+
def delegate_open3(cmd, args, kwargs, sudo: T.unsafe(nil), env: T.unsafe(nil), method: T.unsafe(nil), &block); end
|
|
1950
|
+
|
|
1951
|
+
# source://cli-kit//lib/cli/kit/support/test_helper.rb#240
|
|
1952
|
+
def expected_command(a, sudo: T.unsafe(nil), env: T.unsafe(nil)); end
|
|
1953
|
+
|
|
1954
|
+
# Ruby resolves the program to execute using its own PATH, but we want it to
|
|
1955
|
+
# use the provided one, so we ensure ruby chooses to spawn a shell, which will
|
|
1956
|
+
# parse our command and properly spawn our target using the provided environment.
|
|
1957
|
+
#
|
|
1958
|
+
# This is important because dev clobbers its own environment such that ruby
|
|
1959
|
+
# means /usr/bin/ruby, but we want it to select the ruby targeted by the active
|
|
1960
|
+
# project.
|
|
1961
|
+
#
|
|
1962
|
+
# See https://github.com/Shopify/dev/pull/625 for more details.
|
|
1963
|
+
# : (String cmd, Array[String] args, Hash[String, String?] env) -> [String, Array[String]]
|
|
1964
|
+
#
|
|
1965
|
+
# source://cli-kit//lib/cli/kit/system.rb#277
|
|
1966
|
+
def resolve_path(cmd, args, env); end
|
|
1967
|
+
end
|
|
1968
|
+
end
|
|
1969
|
+
|
|
1970
|
+
# source://cli-kit//lib/cli/kit/system.rb#10
|
|
1971
|
+
CLI::Kit::System::SUDO_PROMPT = T.let(T.unsafe(nil), String)
|
|
1972
|
+
|
|
1973
|
+
# : untyped
|
|
1974
|
+
#
|
|
1975
|
+
# source://cli-kit//lib/cli/kit.rb#29
|
|
1976
|
+
CLI::Kit::UNTYPED_NIL = T.let(T.unsafe(nil), T.untyped)
|
|
1977
|
+
|
|
1978
|
+
# source://cli-kit//lib/cli/kit/util.rb#7
|
|
1979
|
+
module CLI::Kit::Util
|
|
1980
|
+
class << self
|
|
1981
|
+
# Must call retry_after on the result in order to execute the block
|
|
1982
|
+
#
|
|
1983
|
+
# Example usage:
|
|
1984
|
+
#
|
|
1985
|
+
# CLI::Kit::Util.begin do
|
|
1986
|
+
# might_raise_if_costly_prep_not_done()
|
|
1987
|
+
# end.retry_after(ExpectedError) do
|
|
1988
|
+
# costly_prep()
|
|
1989
|
+
# end
|
|
1990
|
+
# : [T] { -> T } -> Retrier[T]
|
|
1991
|
+
#
|
|
1992
|
+
# source://cli-kit//lib/cli/kit/util.rb#82
|
|
1993
|
+
def begin(&block_that_might_raise); end
|
|
1994
|
+
|
|
1995
|
+
# Converts an integer representing bytes into a human readable format
|
|
1996
|
+
#
|
|
1997
|
+
# : (Integer bytes, ?precision: Integer, ?space: bool) -> String
|
|
1998
|
+
#
|
|
1999
|
+
# source://cli-kit//lib/cli/kit/util.rb#13
|
|
2000
|
+
def to_filesize(bytes, precision: T.unsafe(nil), space: T.unsafe(nil)); end
|
|
2001
|
+
|
|
2002
|
+
# Converts a number to a human readable format on the SI scale
|
|
2003
|
+
#
|
|
2004
|
+
# : (Numeric number, ?String unit, ?factor: Integer, ?precision: Integer, ?space: bool) -> String
|
|
2005
|
+
#
|
|
2006
|
+
# @raise [ArgumentError]
|
|
2007
|
+
#
|
|
2008
|
+
# source://cli-kit//lib/cli/kit/util.rb#20
|
|
2009
|
+
def to_si_scale(number, unit = T.unsafe(nil), factor: T.unsafe(nil), precision: T.unsafe(nil), space: T.unsafe(nil)); end
|
|
2010
|
+
|
|
2011
|
+
# Dir.chdir, when invoked in block form, complains when we call chdir
|
|
2012
|
+
# again recursively. There's no apparent good reason for this, so we
|
|
2013
|
+
# simply implement our own block form of Dir.chdir here.
|
|
2014
|
+
# : [T] (String dir) { -> T } -> T
|
|
2015
|
+
#
|
|
2016
|
+
# source://cli-kit//lib/cli/kit/util.rb#62
|
|
2017
|
+
def with_dir(dir, &block); end
|
|
2018
|
+
end
|
|
2019
|
+
end
|
|
2020
|
+
|
|
2021
|
+
# : [BlockReturnType]
|
|
2022
|
+
#
|
|
2023
|
+
# source://cli-kit//lib/cli/kit/util.rb#88
|
|
2024
|
+
class CLI::Kit::Util::Retrier
|
|
2025
|
+
# : (^-> BlockReturnType block_that_might_raise) -> void
|
|
2026
|
+
#
|
|
2027
|
+
# @return [Retrier] a new instance of Retrier
|
|
2028
|
+
#
|
|
2029
|
+
# source://cli-kit//lib/cli/kit/util.rb#90
|
|
2030
|
+
def initialize(block_that_might_raise); end
|
|
2031
|
+
|
|
2032
|
+
# : (?singleton(Exception) exception, ?retries: Integer) ?{ (Exception e) -> void } -> BlockReturnType
|
|
2033
|
+
#
|
|
2034
|
+
# source://cli-kit//lib/cli/kit/util.rb#95
|
|
2035
|
+
def retry_after(exception = T.unsafe(nil), retries: T.unsafe(nil), &before_retry); end
|
|
2036
|
+
end
|
|
2037
|
+
|
|
2038
|
+
# source://cli-kit//lib/cli/kit/core_ext.rb#4
|
|
2039
|
+
class Exception
|
|
2040
|
+
# : (?bool bug) -> void
|
|
2041
|
+
#
|
|
2042
|
+
# source://cli-kit//lib/cli/kit/core_ext.rb#20
|
|
2043
|
+
def bug!(bug = T.unsafe(nil)); end
|
|
2044
|
+
|
|
2045
|
+
# : -> bool
|
|
2046
|
+
#
|
|
2047
|
+
# @return [Boolean]
|
|
2048
|
+
#
|
|
2049
|
+
# source://cli-kit//lib/cli/kit/core_ext.rb#10
|
|
2050
|
+
def bug?; end
|
|
2051
|
+
|
|
2052
|
+
# : (?bool silent) -> void
|
|
2053
|
+
#
|
|
2054
|
+
# source://cli-kit//lib/cli/kit/core_ext.rb#25
|
|
2055
|
+
def silent!(silent = T.unsafe(nil)); end
|
|
2056
|
+
|
|
2057
|
+
# : -> bool
|
|
2058
|
+
#
|
|
2059
|
+
# @return [Boolean]
|
|
2060
|
+
#
|
|
2061
|
+
# source://cli-kit//lib/cli/kit/core_ext.rb#15
|
|
2062
|
+
def silent?; end
|
|
2063
|
+
end
|