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