tsumanne 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.dockerignore +8 -0
- data/.mdlrc +6 -0
- data/.rubocop.yml +20 -12
- data/Dockerfile +24 -0
- data/README.md +0 -4
- data/Rakefile +19 -16
- data/exe/tsumanne +2 -1
- data/lib/tsumanne/api.rb +22 -21
- data/lib/tsumanne/cli.rb +153 -2
- data/lib/tsumanne/models/get_threads.rb +8 -3
- data/lib/tsumanne/models/register_thread.rb +5 -1
- data/lib/tsumanne/models/search_indexes.rb +7 -2
- data/lib/tsumanne/models/search_thread_from_uri.rb +14 -2
- data/lib/tsumanne/version.rb +1 -1
- data/mise.toml +42 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/{ast@2.4.2.rbi → ast@2.4.3.rbi} +45 -79
- data/sorbet/rbi/gems/benchmark@0.5.0.rbi +621 -0
- data/sorbet/rbi/gems/{chef-utils@18.2.7.rbi → chef-utils@18.8.54.rbi} +1 -0
- data/sorbet/rbi/gems/{concurrent-ruby@1.2.2.rbi → concurrent-ruby@1.3.5.rbi} +1 -0
- data/sorbet/rbi/gems/{diff-lcs@1.5.0.rbi → diff-lcs@1.6.2.rbi} +183 -199
- data/sorbet/rbi/gems/docile@1.4.0.rbi +147 -147
- data/sorbet/rbi/gems/{erubi@1.12.0.rbi → erubi@1.13.1.rbi} +36 -26
- data/sorbet/rbi/gems/{json@2.6.3.rbi → json@2.19.4.rbi} +920 -251
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +32 -63
- data/sorbet/rbi/gems/{kramdown@2.4.0.rbi → kramdown@2.5.1.rbi} +896 -711
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
- data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
- data/sorbet/rbi/gems/{mdl@0.12.0.rbi → mdl@0.15.0.rbi} +109 -113
- data/sorbet/rbi/gems/mixlib-cli@2.1.8.rbi +35 -41
- data/sorbet/rbi/gems/mixlib-config@3.0.27.rbi +147 -142
- data/sorbet/rbi/gems/{mixlib-shellout@3.2.7.rbi → mixlib-shellout@3.3.9.rbi} +127 -150
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +45 -56
- data/sorbet/rbi/gems/optimist@3.2.1.rbi +895 -0
- data/sorbet/rbi/gems/parallel@1.28.0.rbi +270 -0
- data/sorbet/rbi/gems/parser@3.3.11.1.rbi +5229 -0
- data/sorbet/rbi/gems/prism@1.9.0.rbi +42224 -0
- data/sorbet/rbi/gems/{racc@1.7.1.rbi → racc@1.8.1.rbi} +48 -44
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +101 -141
- data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.4.2.rbi} +867 -761
- data/sorbet/rbi/gems/rbi@0.3.10.rbi +5520 -0
- data/sorbet/rbi/gems/rbs@4.0.2.rbi +6908 -0
- data/sorbet/rbi/gems/regexp_parser@2.12.0.rbi +3398 -0
- data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
- data/sorbet/rbi/gems/{rexml@3.2.6.rbi → rexml@3.4.4.rbi} +1032 -908
- data/sorbet/rbi/gems/{rspec-core@3.12.2.rbi → rspec-core@3.13.6.rbi} +2860 -4206
- data/sorbet/rbi/gems/rspec-expectations@3.13.5.rbi +6108 -0
- data/sorbet/rbi/gems/{rspec-mocks@3.12.6.rbi → rspec-mocks@3.13.7.rbi} +1264 -1787
- data/sorbet/rbi/gems/rspec-support@3.13.6.rbi +1274 -0
- data/sorbet/rbi/gems/rspec@3.13.2.rbi +15 -0
- data/sorbet/rbi/gems/rubocop-ast@1.49.1.rbi +7212 -0
- data/sorbet/rbi/gems/rubocop-performance@1.26.1.rbi +3403 -0
- data/sorbet/rbi/gems/{rubocop-rake@0.6.0.rbi → rubocop-rake@0.7.1.rbi} +89 -103
- data/sorbet/rbi/gems/rubocop-rspec@3.9.0.rbi +7606 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.12.0.rbi +2448 -0
- data/sorbet/rbi/gems/rubocop@1.86.1.rbi +62232 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +326 -655
- data/sorbet/rbi/gems/rubydex@0.1.0.beta14.rbi +655 -0
- data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +24 -158
- data/sorbet/rbi/gems/simplecov@0.22.0.rbi +450 -606
- data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +32 -166
- data/sorbet/rbi/gems/spoom@1.7.13.rbi +6151 -0
- data/sorbet/rbi/gems/{tapioca@0.11.8.rbi → tapioca@0.19.1.rbi} +1609 -1379
- data/sorbet/rbi/gems/{thor@1.2.2.rbi → thor@1.5.0.rbi} +1075 -1170
- data/sorbet/rbi/gems/tomlrb@2.0.3.rbi +1 -0
- data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
- data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +130 -0
- data/sorbet/rbi/gems/unicode-emoji@4.2.0.rbi +332 -0
- metadata +69 -66
- data/.ruby-version +0 -1
- data/sorbet/rbi/gems/base64@0.1.1.rbi +0 -172
- data/sorbet/rbi/gems/ffi-compiler@1.0.1.rbi +0 -206
- data/sorbet/rbi/gems/ffi@1.15.5.rbi +0 -1994
- data/sorbet/rbi/gems/http-parser@1.2.3.rbi +0 -422
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14237
- data/sorbet/rbi/gems/mhtml@0.1.6.rbi +0 -353
- data/sorbet/rbi/gems/parallel@1.23.0.rbi +0 -273
- data/sorbet/rbi/gems/parser@3.2.2.3.rbi +0 -7253
- data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +0 -951
- data/sorbet/rbi/gems/rbi@0.0.17.rbi +0 -2967
- data/sorbet/rbi/gems/regexp_parser@2.8.1.rbi +0 -3749
- data/sorbet/rbi/gems/rspec-expectations@3.12.3.rbi +0 -8100
- data/sorbet/rbi/gems/rspec-support@3.12.1.rbi +0 -1609
- data/sorbet/rbi/gems/rspec@3.12.0.rbi +0 -82
- data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +0 -7144
- data/sorbet/rbi/gems/rubocop-capybara@2.18.0.rbi +0 -827
- data/sorbet/rbi/gems/rubocop-factory_bot@2.23.1.rbi +0 -812
- data/sorbet/rbi/gems/rubocop-performance@1.19.0.rbi +0 -3157
- data/sorbet/rbi/gems/rubocop-rspec@2.23.2.rbi +0 -7691
- data/sorbet/rbi/gems/rubocop-sorbet@0.7.3.rbi +0 -1226
- data/sorbet/rbi/gems/rubocop@1.56.2.rbi +0 -56541
- data/sorbet/rbi/gems/spoom@1.2.3.rbi +0 -3199
- data/sorbet/rbi/gems/syntax_tree@6.1.1.rbi +0 -22855
- data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +0 -65
- data/sorbet/rbi/gems/unparser@0.6.8.rbi +0 -4525
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +0 -425
- data/sorbet/rbi/gems/yard@0.9.34.rbi +0 -18219
|
@@ -0,0 +1,895 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This is an autogenerated file for types exported from the `optimist` gem.
|
|
5
|
+
# Please instead update this file by running `bin/tapioca gem optimist`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# pkg:gem/optimist#lib/optimist.rb:10
|
|
9
|
+
module Optimist
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
# Informs the user that their usage of 'arg' was wrong, as detailed by
|
|
13
|
+
# 'msg', and dies. Example:
|
|
14
|
+
#
|
|
15
|
+
# options do
|
|
16
|
+
# opt :volume, :default => 0.0
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# die :volume, "too loud" if opts[:volume] > 10.0
|
|
20
|
+
# die :volume, "too soft" if opts[:volume] < 0.1
|
|
21
|
+
#
|
|
22
|
+
# In the one-argument case, simply print that message, a notice
|
|
23
|
+
# about -h, and die. Example:
|
|
24
|
+
#
|
|
25
|
+
# options do
|
|
26
|
+
# opt :whatever # ...
|
|
27
|
+
# end
|
|
28
|
+
#
|
|
29
|
+
# Optimist::die "need at least one filename" if ARGV.empty?
|
|
30
|
+
#
|
|
31
|
+
# An exit code can be provide if needed
|
|
32
|
+
#
|
|
33
|
+
# Optimist::die "need at least one filename", -2 if ARGV.empty?
|
|
34
|
+
#
|
|
35
|
+
# pkg:gem/optimist#lib/optimist.rb:1246
|
|
36
|
+
def die(arg, msg = T.unsafe(nil), error_code = T.unsafe(nil)); end
|
|
37
|
+
|
|
38
|
+
# Displays the help message and dies. Example:
|
|
39
|
+
#
|
|
40
|
+
# options do
|
|
41
|
+
# opt :volume, :default => 0.0
|
|
42
|
+
# banner <<-EOS
|
|
43
|
+
# Usage:
|
|
44
|
+
# #$0 [options] <name>
|
|
45
|
+
# where [options] are:
|
|
46
|
+
# EOS
|
|
47
|
+
# end
|
|
48
|
+
#
|
|
49
|
+
# Optimist::educate if ARGV.empty?
|
|
50
|
+
#
|
|
51
|
+
# pkg:gem/optimist#lib/optimist.rb:1266
|
|
52
|
+
def educate; end
|
|
53
|
+
|
|
54
|
+
# The easy, syntactic-sugary entry method into Optimist. Creates a Parser,
|
|
55
|
+
# passes the block to it, then parses +args+ with it, handling any errors or
|
|
56
|
+
# requests for help or version information appropriately (and then exiting).
|
|
57
|
+
# Modifies +args+ in place. Returns a hash of option values.
|
|
58
|
+
#
|
|
59
|
+
# The block passed in should contain zero or more calls to +opt+
|
|
60
|
+
# (Parser#opt), zero or more calls to +text+ (Parser#text), and
|
|
61
|
+
# probably a call to +version+ (Parser#version).
|
|
62
|
+
#
|
|
63
|
+
# The returned block contains a value for every option specified with
|
|
64
|
+
# +opt+. The value will be the value given on the commandline, or the
|
|
65
|
+
# default value if the option was not specified on the commandline. For
|
|
66
|
+
# every option specified on the commandline, a key "<option
|
|
67
|
+
# name>_given" will also be set in the hash.
|
|
68
|
+
#
|
|
69
|
+
# Example:
|
|
70
|
+
#
|
|
71
|
+
# require 'optimist'
|
|
72
|
+
# opts = Optimist::options do
|
|
73
|
+
# opt :monkey, "Use monkey mode" # a flag --monkey, defaulting to false
|
|
74
|
+
# opt :name, "Monkey name", :type => :string # a string --name <s>, defaulting to nil
|
|
75
|
+
# opt :num_limbs, "Number of limbs", :default => 4 # an integer --num-limbs <i>, defaulting to 4
|
|
76
|
+
# end
|
|
77
|
+
#
|
|
78
|
+
# ## if called with no arguments
|
|
79
|
+
# p opts # => {:monkey=>false, :name=>nil, :num_limbs=>4, :help=>false}
|
|
80
|
+
#
|
|
81
|
+
# ## if called with --monkey
|
|
82
|
+
# p opts # => {:monkey=>true, :name=>nil, :num_limbs=>4, :help=>false, :monkey_given=>true}
|
|
83
|
+
#
|
|
84
|
+
# Settings:
|
|
85
|
+
# Optimist::options and Optimist::Parser.new accept +settings+ to control how
|
|
86
|
+
# options are interpreted. These settings are given as hash arguments, e.g:
|
|
87
|
+
#
|
|
88
|
+
# opts = Optimist::options(ARGV, exact_match: false) do
|
|
89
|
+
# opt :foobar, 'messed up'
|
|
90
|
+
# opt :forget, 'forget it'
|
|
91
|
+
# end
|
|
92
|
+
#
|
|
93
|
+
# +settings+ include:
|
|
94
|
+
# * :exact_match : (default=true) Allow minimum unambigous number of characters to match a long option
|
|
95
|
+
# * :suggestions : (default=true) Enables suggestions when unknown arguments are given and DidYouMean is installed. DidYouMean comes standard with Ruby 2.3+
|
|
96
|
+
# * :implicit_short_opts : (default=true) Short options will only be created where explicitly defined. If you do not like short-options, this will prevent having to define :short=> :none for all of your options.
|
|
97
|
+
# Because Optimist::options uses a default argument for +args+, you must pass that argument when using the settings feature.
|
|
98
|
+
#
|
|
99
|
+
# See more examples at https://www.manageiq.org/optimist
|
|
100
|
+
#
|
|
101
|
+
# pkg:gem/optimist#lib/optimist.rb:1182
|
|
102
|
+
def options(args = T.unsafe(nil), *a, &b); end
|
|
103
|
+
|
|
104
|
+
# If Optimist::options doesn't do quite what you want, you can create a Parser
|
|
105
|
+
# object and call Parser#parse on it. That method will throw CommandlineError,
|
|
106
|
+
# HelpNeeded and VersionNeeded exceptions when necessary; if you want to
|
|
107
|
+
# have these handled for you in the standard manner (e.g. show the help
|
|
108
|
+
# and then exit upon an HelpNeeded exception), call your code from within
|
|
109
|
+
# a block passed to this method.
|
|
110
|
+
#
|
|
111
|
+
# Note that this method will call System#exit after handling an exception!
|
|
112
|
+
#
|
|
113
|
+
# Usage example:
|
|
114
|
+
#
|
|
115
|
+
# require 'optimist'
|
|
116
|
+
# p = Optimist::Parser.new do
|
|
117
|
+
# opt :monkey, "Use monkey mode" # a flag --monkey, defaulting to false
|
|
118
|
+
# opt :goat, "Use goat mode", :default => true # a flag --goat, defaulting to true
|
|
119
|
+
# end
|
|
120
|
+
#
|
|
121
|
+
# opts = Optimist::with_standard_exception_handling p do
|
|
122
|
+
# o = p.parse ARGV
|
|
123
|
+
# raise Optimist::HelpNeeded if ARGV.empty? # show help screen
|
|
124
|
+
# o
|
|
125
|
+
# end
|
|
126
|
+
#
|
|
127
|
+
# Requires passing in the parser object.
|
|
128
|
+
#
|
|
129
|
+
# pkg:gem/optimist#lib/optimist.rb:1212
|
|
130
|
+
def with_standard_exception_handling(parser); end
|
|
131
|
+
|
|
132
|
+
class << self
|
|
133
|
+
# Informs the user that their usage of 'arg' was wrong, as detailed by
|
|
134
|
+
# 'msg', and dies. Example:
|
|
135
|
+
#
|
|
136
|
+
# options do
|
|
137
|
+
# opt :volume, :default => 0.0
|
|
138
|
+
# end
|
|
139
|
+
#
|
|
140
|
+
# die :volume, "too loud" if opts[:volume] > 10.0
|
|
141
|
+
# die :volume, "too soft" if opts[:volume] < 0.1
|
|
142
|
+
#
|
|
143
|
+
# In the one-argument case, simply print that message, a notice
|
|
144
|
+
# about -h, and die. Example:
|
|
145
|
+
#
|
|
146
|
+
# options do
|
|
147
|
+
# opt :whatever # ...
|
|
148
|
+
# end
|
|
149
|
+
#
|
|
150
|
+
# Optimist::die "need at least one filename" if ARGV.empty?
|
|
151
|
+
#
|
|
152
|
+
# An exit code can be provide if needed
|
|
153
|
+
#
|
|
154
|
+
# Optimist::die "need at least one filename", -2 if ARGV.empty?
|
|
155
|
+
#
|
|
156
|
+
# pkg:gem/optimist#lib/optimist.rb:1275
|
|
157
|
+
def die(arg, msg = T.unsafe(nil), error_code = T.unsafe(nil)); end
|
|
158
|
+
|
|
159
|
+
# Displays the help message and dies. Example:
|
|
160
|
+
#
|
|
161
|
+
# options do
|
|
162
|
+
# opt :volume, :default => 0.0
|
|
163
|
+
# banner <<-EOS
|
|
164
|
+
# Usage:
|
|
165
|
+
# #$0 [options] <name>
|
|
166
|
+
# where [options] are:
|
|
167
|
+
# EOS
|
|
168
|
+
# end
|
|
169
|
+
#
|
|
170
|
+
# Optimist::educate if ARGV.empty?
|
|
171
|
+
#
|
|
172
|
+
# pkg:gem/optimist#lib/optimist.rb:1275
|
|
173
|
+
def educate; end
|
|
174
|
+
|
|
175
|
+
# The easy, syntactic-sugary entry method into Optimist. Creates a Parser,
|
|
176
|
+
# passes the block to it, then parses +args+ with it, handling any errors or
|
|
177
|
+
# requests for help or version information appropriately (and then exiting).
|
|
178
|
+
# Modifies +args+ in place. Returns a hash of option values.
|
|
179
|
+
#
|
|
180
|
+
# The block passed in should contain zero or more calls to +opt+
|
|
181
|
+
# (Parser#opt), zero or more calls to +text+ (Parser#text), and
|
|
182
|
+
# probably a call to +version+ (Parser#version).
|
|
183
|
+
#
|
|
184
|
+
# The returned block contains a value for every option specified with
|
|
185
|
+
# +opt+. The value will be the value given on the commandline, or the
|
|
186
|
+
# default value if the option was not specified on the commandline. For
|
|
187
|
+
# every option specified on the commandline, a key "<option
|
|
188
|
+
# name>_given" will also be set in the hash.
|
|
189
|
+
#
|
|
190
|
+
# Example:
|
|
191
|
+
#
|
|
192
|
+
# require 'optimist'
|
|
193
|
+
# opts = Optimist::options do
|
|
194
|
+
# opt :monkey, "Use monkey mode" # a flag --monkey, defaulting to false
|
|
195
|
+
# opt :name, "Monkey name", :type => :string # a string --name <s>, defaulting to nil
|
|
196
|
+
# opt :num_limbs, "Number of limbs", :default => 4 # an integer --num-limbs <i>, defaulting to 4
|
|
197
|
+
# end
|
|
198
|
+
#
|
|
199
|
+
# ## if called with no arguments
|
|
200
|
+
# p opts # => {:monkey=>false, :name=>nil, :num_limbs=>4, :help=>false}
|
|
201
|
+
#
|
|
202
|
+
# ## if called with --monkey
|
|
203
|
+
# p opts # => {:monkey=>true, :name=>nil, :num_limbs=>4, :help=>false, :monkey_given=>true}
|
|
204
|
+
#
|
|
205
|
+
# Settings:
|
|
206
|
+
# Optimist::options and Optimist::Parser.new accept +settings+ to control how
|
|
207
|
+
# options are interpreted. These settings are given as hash arguments, e.g:
|
|
208
|
+
#
|
|
209
|
+
# opts = Optimist::options(ARGV, exact_match: false) do
|
|
210
|
+
# opt :foobar, 'messed up'
|
|
211
|
+
# opt :forget, 'forget it'
|
|
212
|
+
# end
|
|
213
|
+
#
|
|
214
|
+
# +settings+ include:
|
|
215
|
+
# * :exact_match : (default=true) Allow minimum unambigous number of characters to match a long option
|
|
216
|
+
# * :suggestions : (default=true) Enables suggestions when unknown arguments are given and DidYouMean is installed. DidYouMean comes standard with Ruby 2.3+
|
|
217
|
+
# * :implicit_short_opts : (default=true) Short options will only be created where explicitly defined. If you do not like short-options, this will prevent having to define :short=> :none for all of your options.
|
|
218
|
+
# Because Optimist::options uses a default argument for +args+, you must pass that argument when using the settings feature.
|
|
219
|
+
#
|
|
220
|
+
# See more examples at https://www.manageiq.org/optimist
|
|
221
|
+
#
|
|
222
|
+
# pkg:gem/optimist#lib/optimist.rb:1275
|
|
223
|
+
def options(args = T.unsafe(nil), *a, &b); end
|
|
224
|
+
|
|
225
|
+
# If Optimist::options doesn't do quite what you want, you can create a Parser
|
|
226
|
+
# object and call Parser#parse on it. That method will throw CommandlineError,
|
|
227
|
+
# HelpNeeded and VersionNeeded exceptions when necessary; if you want to
|
|
228
|
+
# have these handled for you in the standard manner (e.g. show the help
|
|
229
|
+
# and then exit upon an HelpNeeded exception), call your code from within
|
|
230
|
+
# a block passed to this method.
|
|
231
|
+
#
|
|
232
|
+
# Note that this method will call System#exit after handling an exception!
|
|
233
|
+
#
|
|
234
|
+
# Usage example:
|
|
235
|
+
#
|
|
236
|
+
# require 'optimist'
|
|
237
|
+
# p = Optimist::Parser.new do
|
|
238
|
+
# opt :monkey, "Use monkey mode" # a flag --monkey, defaulting to false
|
|
239
|
+
# opt :goat, "Use goat mode", :default => true # a flag --goat, defaulting to true
|
|
240
|
+
# end
|
|
241
|
+
#
|
|
242
|
+
# opts = Optimist::with_standard_exception_handling p do
|
|
243
|
+
# o = p.parse ARGV
|
|
244
|
+
# raise Optimist::HelpNeeded if ARGV.empty? # show help screen
|
|
245
|
+
# o
|
|
246
|
+
# end
|
|
247
|
+
#
|
|
248
|
+
# Requires passing in the parser object.
|
|
249
|
+
#
|
|
250
|
+
# pkg:gem/optimist#lib/optimist.rb:1275
|
|
251
|
+
def with_standard_exception_handling(parser); end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Flag option. Has no arguments. Can be negated with "no-".
|
|
256
|
+
#
|
|
257
|
+
# pkg:gem/optimist#lib/optimist.rb:996
|
|
258
|
+
class Optimist::BooleanOption < ::Optimist::Option
|
|
259
|
+
# pkg:gem/optimist#lib/optimist.rb:998
|
|
260
|
+
def initialize; end
|
|
261
|
+
|
|
262
|
+
# pkg:gem/optimist#lib/optimist.rb:1002
|
|
263
|
+
def flag?; end
|
|
264
|
+
|
|
265
|
+
# pkg:gem/optimist#lib/optimist.rb:1003
|
|
266
|
+
def parse(_paramlist, neg_given); end
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Thrown by Parser in the event of a commandline error. Not needed if
|
|
270
|
+
# you're using the Optimist::options entry.
|
|
271
|
+
#
|
|
272
|
+
# pkg:gem/optimist#lib/optimist.rb:15
|
|
273
|
+
class Optimist::CommandlineError < ::StandardError
|
|
274
|
+
# pkg:gem/optimist#lib/optimist.rb:18
|
|
275
|
+
def initialize(msg, error_code = T.unsafe(nil)); end
|
|
276
|
+
|
|
277
|
+
# pkg:gem/optimist#lib/optimist.rb:16
|
|
278
|
+
def error_code; end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# A Conflict constraint. Useful when Option A cannot be used with Option B.
|
|
282
|
+
#
|
|
283
|
+
# pkg:gem/optimist#lib/optimist.rb:65
|
|
284
|
+
class Optimist::ConflictConstraint < ::Optimist::Constraint
|
|
285
|
+
# pkg:gem/optimist#lib/optimist.rb:66
|
|
286
|
+
def error_condition(overlap_size); end
|
|
287
|
+
|
|
288
|
+
# pkg:gem/optimist#lib/optimist.rb:69
|
|
289
|
+
def error_message(longargs); end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
# Abstract class for a constraint. Do not use by itself.
|
|
293
|
+
#
|
|
294
|
+
# pkg:gem/optimist#lib/optimist.rb:41
|
|
295
|
+
class Optimist::Constraint
|
|
296
|
+
# pkg:gem/optimist#lib/optimist.rb:42
|
|
297
|
+
def initialize(syms); end
|
|
298
|
+
|
|
299
|
+
# pkg:gem/optimist#lib/optimist.rb:45
|
|
300
|
+
def validate(given_args:, specs:); end
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Option class for handling multiple dates
|
|
304
|
+
#
|
|
305
|
+
# pkg:gem/optimist#lib/optimist.rb:1123
|
|
306
|
+
class Optimist::DateArrayOption < ::Optimist::DateOption
|
|
307
|
+
# pkg:gem/optimist#lib/optimist.rb:1126
|
|
308
|
+
def multi_arg?; end
|
|
309
|
+
|
|
310
|
+
# pkg:gem/optimist#lib/optimist.rb:1125
|
|
311
|
+
def type_format; end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Option for dates. Uses Chronic if it exists.
|
|
315
|
+
#
|
|
316
|
+
# pkg:gem/optimist#lib/optimist.rb:1073
|
|
317
|
+
class Optimist::DateOption < ::Optimist::Option
|
|
318
|
+
# pkg:gem/optimist#lib/optimist.rb:1076
|
|
319
|
+
def parse(paramlist, _neg_given); end
|
|
320
|
+
|
|
321
|
+
# pkg:gem/optimist#lib/optimist.rb:1075
|
|
322
|
+
def type_format; end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# A Dependency constraint. Useful when Option A requires Option B also be used.
|
|
326
|
+
#
|
|
327
|
+
# pkg:gem/optimist#lib/optimist.rb:55
|
|
328
|
+
class Optimist::DependConstraint < ::Optimist::Constraint
|
|
329
|
+
# pkg:gem/optimist#lib/optimist.rb:56
|
|
330
|
+
def error_condition(overlap_size); end
|
|
331
|
+
|
|
332
|
+
# pkg:gem/optimist#lib/optimist.rb:59
|
|
333
|
+
def error_message(longargs); end
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# An Either-Or constraint. For Mutually exclusive options
|
|
337
|
+
#
|
|
338
|
+
# pkg:gem/optimist#lib/optimist.rb:75
|
|
339
|
+
class Optimist::EitherConstraint < ::Optimist::Constraint
|
|
340
|
+
# pkg:gem/optimist#lib/optimist.rb:76
|
|
341
|
+
def error_condition(overlap_size); end
|
|
342
|
+
|
|
343
|
+
# pkg:gem/optimist#lib/optimist.rb:79
|
|
344
|
+
def error_message(longargs); end
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Regex for floating point numbers
|
|
348
|
+
#
|
|
349
|
+
# pkg:gem/optimist#lib/optimist.rb:35
|
|
350
|
+
Optimist::FLOAT_RE = T.let(T.unsafe(nil), Regexp)
|
|
351
|
+
|
|
352
|
+
# Option class for handling multiple Floats
|
|
353
|
+
#
|
|
354
|
+
# pkg:gem/optimist#lib/optimist.rb:1109
|
|
355
|
+
class Optimist::FloatArrayOption < ::Optimist::FloatOption
|
|
356
|
+
# pkg:gem/optimist#lib/optimist.rb:1112
|
|
357
|
+
def multi_arg?; end
|
|
358
|
+
|
|
359
|
+
# pkg:gem/optimist#lib/optimist.rb:1111
|
|
360
|
+
def type_format; end
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# Floating point number option class.
|
|
364
|
+
#
|
|
365
|
+
# pkg:gem/optimist#lib/optimist.rb:1009
|
|
366
|
+
class Optimist::FloatOption < ::Optimist::Option
|
|
367
|
+
# pkg:gem/optimist#lib/optimist.rb:1012
|
|
368
|
+
def as_type(param); end
|
|
369
|
+
|
|
370
|
+
# pkg:gem/optimist#lib/optimist.rb:1013
|
|
371
|
+
def parse(paramlist, _neg_given); end
|
|
372
|
+
|
|
373
|
+
# pkg:gem/optimist#lib/optimist.rb:1011
|
|
374
|
+
def type_format; end
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# Thrown by Parser if the user passes in '-h' or '--help'. Handled
|
|
378
|
+
# automatically by Optimist#options.
|
|
379
|
+
#
|
|
380
|
+
# pkg:gem/optimist#lib/optimist.rb:26
|
|
381
|
+
class Optimist::HelpNeeded < ::StandardError; end
|
|
382
|
+
|
|
383
|
+
# Option class for handling Files/URLs via 'open'
|
|
384
|
+
#
|
|
385
|
+
# pkg:gem/optimist#lib/optimist.rb:1130
|
|
386
|
+
class Optimist::IOArrayOption < ::Optimist::IOOption
|
|
387
|
+
# pkg:gem/optimist#lib/optimist.rb:1133
|
|
388
|
+
def multi_arg?; end
|
|
389
|
+
|
|
390
|
+
# pkg:gem/optimist#lib/optimist.rb:1132
|
|
391
|
+
def type_format; end
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
# Option class for handling IO objects and URLs.
|
|
395
|
+
# Note that this will return the file-handle, not the file-name
|
|
396
|
+
# in the case of file-paths given to it.
|
|
397
|
+
#
|
|
398
|
+
# pkg:gem/optimist#lib/optimist.rb:1041
|
|
399
|
+
class Optimist::IOOption < ::Optimist::Option
|
|
400
|
+
# pkg:gem/optimist#lib/optimist.rb:1044
|
|
401
|
+
def parse(paramlist, _neg_given); end
|
|
402
|
+
|
|
403
|
+
# pkg:gem/optimist#lib/optimist.rb:1043
|
|
404
|
+
def type_format; end
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
# Option class for handling multiple Integers
|
|
408
|
+
#
|
|
409
|
+
# pkg:gem/optimist#lib/optimist.rb:1102
|
|
410
|
+
class Optimist::IntegerArrayOption < ::Optimist::IntegerOption
|
|
411
|
+
# pkg:gem/optimist#lib/optimist.rb:1105
|
|
412
|
+
def multi_arg?; end
|
|
413
|
+
|
|
414
|
+
# pkg:gem/optimist#lib/optimist.rb:1104
|
|
415
|
+
def type_format; end
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Integer number option class.
|
|
419
|
+
#
|
|
420
|
+
# pkg:gem/optimist#lib/optimist.rb:1024
|
|
421
|
+
class Optimist::IntegerOption < ::Optimist::Option
|
|
422
|
+
# pkg:gem/optimist#lib/optimist.rb:1027
|
|
423
|
+
def as_type(param); end
|
|
424
|
+
|
|
425
|
+
# pkg:gem/optimist#lib/optimist.rb:1028
|
|
426
|
+
def parse(paramlist, _neg_given); end
|
|
427
|
+
|
|
428
|
+
# pkg:gem/optimist#lib/optimist.rb:1026
|
|
429
|
+
def type_format; end
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
# pkg:gem/optimist#lib/optimist.rb:693
|
|
433
|
+
class Optimist::LongNames
|
|
434
|
+
# pkg:gem/optimist#lib/optimist.rb:694
|
|
435
|
+
def initialize; end
|
|
436
|
+
|
|
437
|
+
# long specified with :long has precedence over the true-name
|
|
438
|
+
#
|
|
439
|
+
# pkg:gem/optimist#lib/optimist.rb:718
|
|
440
|
+
def long; end
|
|
441
|
+
|
|
442
|
+
# pkg:gem/optimist#lib/optimist.rb:700
|
|
443
|
+
def make_valid(lopt); end
|
|
444
|
+
|
|
445
|
+
# all valid names, including alts
|
|
446
|
+
#
|
|
447
|
+
# pkg:gem/optimist#lib/optimist.rb:721
|
|
448
|
+
def names; end
|
|
449
|
+
|
|
450
|
+
# pkg:gem/optimist#lib/optimist.rb:709
|
|
451
|
+
def set(name, lopt, alts); end
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
# pkg:gem/optimist#lib/optimist.rb:765
|
|
455
|
+
class Optimist::Option
|
|
456
|
+
# pkg:gem/optimist#lib/optimist.rb:770
|
|
457
|
+
def initialize; end
|
|
458
|
+
|
|
459
|
+
# note: Option-Types with both multi_arg? and flag? false are single-parameter (normal) options.
|
|
460
|
+
#
|
|
461
|
+
# pkg:gem/optimist#lib/optimist.rb:803
|
|
462
|
+
def array_default?; end
|
|
463
|
+
|
|
464
|
+
# pkg:gem/optimist#lib/optimist.rb:807
|
|
465
|
+
def callback; end
|
|
466
|
+
|
|
467
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
468
|
+
def default; end
|
|
469
|
+
|
|
470
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
471
|
+
def default=(_arg0); end
|
|
472
|
+
|
|
473
|
+
# pkg:gem/optimist#lib/optimist.rb:808
|
|
474
|
+
def desc; end
|
|
475
|
+
|
|
476
|
+
# pkg:gem/optimist#lib/optimist.rb:805
|
|
477
|
+
def doesnt_need_autogen_short; end
|
|
478
|
+
|
|
479
|
+
# pkg:gem/optimist#lib/optimist.rb:819
|
|
480
|
+
def educate; end
|
|
481
|
+
|
|
482
|
+
# Indicates a flag option, which is an option without an argument
|
|
483
|
+
#
|
|
484
|
+
# pkg:gem/optimist#lib/optimist.rb:791
|
|
485
|
+
def flag?; end
|
|
486
|
+
|
|
487
|
+
# Format stdio like objects to a string
|
|
488
|
+
#
|
|
489
|
+
# pkg:gem/optimist#lib/optimist.rb:835
|
|
490
|
+
def format_stdio(obj); end
|
|
491
|
+
|
|
492
|
+
# Format the educate-line description including the default and permitted value(s)
|
|
493
|
+
#
|
|
494
|
+
# pkg:gem/optimist#lib/optimist.rb:827
|
|
495
|
+
def full_description; end
|
|
496
|
+
|
|
497
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
498
|
+
def long; end
|
|
499
|
+
|
|
500
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
501
|
+
def long=(_arg0); end
|
|
502
|
+
|
|
503
|
+
# pkg:gem/optimist#lib/optimist.rb:796
|
|
504
|
+
def multi; end
|
|
505
|
+
|
|
506
|
+
# pkg:gem/optimist#lib/optimist.rb:797
|
|
507
|
+
def multi?; end
|
|
508
|
+
|
|
509
|
+
# Indicates that this is a multivalued (Array type) argument
|
|
510
|
+
#
|
|
511
|
+
# pkg:gem/optimist#lib/optimist.rb:800
|
|
512
|
+
def multi_arg?; end
|
|
513
|
+
|
|
514
|
+
# pkg:gem/optimist#lib/optimist.rb:768
|
|
515
|
+
def multi_given=(_arg0); end
|
|
516
|
+
|
|
517
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
518
|
+
def name; end
|
|
519
|
+
|
|
520
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
521
|
+
def name=(_arg0); end
|
|
522
|
+
|
|
523
|
+
# pkg:gem/optimist#lib/optimist.rb:782
|
|
524
|
+
def opts(key); end
|
|
525
|
+
|
|
526
|
+
# pkg:gem/optimist#lib/optimist.rb:786
|
|
527
|
+
def opts=(o); end
|
|
528
|
+
|
|
529
|
+
# pkg:gem/optimist#lib/optimist.rb:812
|
|
530
|
+
def parse(_paramlist, _neg_given); end
|
|
531
|
+
|
|
532
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
533
|
+
def permitted; end
|
|
534
|
+
|
|
535
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
536
|
+
def permitted=(_arg0); end
|
|
537
|
+
|
|
538
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
539
|
+
def permitted_response; end
|
|
540
|
+
|
|
541
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
542
|
+
def permitted_response=(_arg0); end
|
|
543
|
+
|
|
544
|
+
# pkg:gem/optimist#lib/optimist.rb:868
|
|
545
|
+
def permitted_type_valid?; end
|
|
546
|
+
|
|
547
|
+
# pkg:gem/optimist#lib/optimist.rb:856
|
|
548
|
+
def permitted_valid_string; end
|
|
549
|
+
|
|
550
|
+
# incoming values from the command-line should be strings, so we should
|
|
551
|
+
# stringify any permitted types as the basis of comparison.
|
|
552
|
+
#
|
|
553
|
+
# pkg:gem/optimist#lib/optimist.rb:886
|
|
554
|
+
def permitted_value?(val); end
|
|
555
|
+
|
|
556
|
+
# pkg:gem/optimist#lib/optimist.rb:810
|
|
557
|
+
def required?; end
|
|
558
|
+
|
|
559
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
560
|
+
def short; end
|
|
561
|
+
|
|
562
|
+
# pkg:gem/optimist#lib/optimist.rb:767
|
|
563
|
+
def short=(_arg0); end
|
|
564
|
+
|
|
565
|
+
# pkg:gem/optimist#lib/optimist.rb:792
|
|
566
|
+
def single_arg?; end
|
|
567
|
+
|
|
568
|
+
# provide type-format string. default to empty, but user should probably override it
|
|
569
|
+
#
|
|
570
|
+
# pkg:gem/optimist#lib/optimist.rb:817
|
|
571
|
+
def type_format; end
|
|
572
|
+
|
|
573
|
+
# pkg:gem/optimist#lib/optimist.rb:875
|
|
574
|
+
def validate_permitted(arg, value); end
|
|
575
|
+
|
|
576
|
+
private
|
|
577
|
+
|
|
578
|
+
# Generate the default value string for the educate line
|
|
579
|
+
#
|
|
580
|
+
# pkg:gem/optimist#lib/optimist.rb:845
|
|
581
|
+
def default_description_str(str); end
|
|
582
|
+
|
|
583
|
+
# Generate the permitted values string for the educate line
|
|
584
|
+
#
|
|
585
|
+
# pkg:gem/optimist#lib/optimist.rb:897
|
|
586
|
+
def permitted_description_str(str); end
|
|
587
|
+
|
|
588
|
+
class << self
|
|
589
|
+
# Determines which type of object to create based on arguments passed
|
|
590
|
+
# to +Optimist::opt+. This is trickier in Optimist, than other cmdline
|
|
591
|
+
# parsers (e.g. Slop) because we allow the +default:+ to be able to
|
|
592
|
+
# set the option's type.
|
|
593
|
+
#
|
|
594
|
+
# pkg:gem/optimist#lib/optimist.rb:926
|
|
595
|
+
def create(name, desc = T.unsafe(nil), opts = T.unsafe(nil), settings = T.unsafe(nil)); end
|
|
596
|
+
|
|
597
|
+
# pkg:gem/optimist#lib/optimist.rb:976
|
|
598
|
+
def get_klass_from_default(opts, opttype); end
|
|
599
|
+
|
|
600
|
+
# pkg:gem/optimist#lib/optimist.rb:963
|
|
601
|
+
def get_type_from_disdef(optdef, opttype, disambiguated_default); end
|
|
602
|
+
|
|
603
|
+
# Provide a way to register symbol aliases to the Parser
|
|
604
|
+
#
|
|
605
|
+
# pkg:gem/optimist#lib/optimist.rb:913
|
|
606
|
+
def register_alias(*alias_keys); end
|
|
607
|
+
end
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
# Regex for parameters
|
|
611
|
+
#
|
|
612
|
+
# pkg:gem/optimist#lib/optimist.rb:38
|
|
613
|
+
Optimist::PARAM_RE = T.let(T.unsafe(nil), Regexp)
|
|
614
|
+
|
|
615
|
+
# The commandline parser. In typical usage, the methods in this class
|
|
616
|
+
# will be handled internally by Optimist::options. In this case, only the
|
|
617
|
+
# #opt, #banner and #version, #depends, and #conflicts methods will
|
|
618
|
+
# typically be called.
|
|
619
|
+
#
|
|
620
|
+
# If you want to instantiate this class yourself (for more complicated
|
|
621
|
+
# argument-parsing logic), call #parse to actually produce the output hash,
|
|
622
|
+
# and consider calling it from within
|
|
623
|
+
# Optimist::with_standard_exception_handling.
|
|
624
|
+
#
|
|
625
|
+
# pkg:gem/optimist#lib/optimist.rb:93
|
|
626
|
+
class Optimist::Parser
|
|
627
|
+
# Initializes the parser, and instance-evaluates any block given.
|
|
628
|
+
#
|
|
629
|
+
# pkg:gem/optimist#lib/optimist.rb:136
|
|
630
|
+
def initialize(*a, &b); end
|
|
631
|
+
|
|
632
|
+
# Adds text to the help display. Can be interspersed with calls to
|
|
633
|
+
# #opt to build a multi-section help page.
|
|
634
|
+
#
|
|
635
|
+
# pkg:gem/optimist#lib/optimist.rb:250
|
|
636
|
+
def banner(s); end
|
|
637
|
+
|
|
638
|
+
# Marks two (or more!) options as conflicting.
|
|
639
|
+
#
|
|
640
|
+
# pkg:gem/optimist#lib/optimist.rb:264
|
|
641
|
+
def conflicts(*syms); end
|
|
642
|
+
|
|
643
|
+
# Marks two (or more!) options as requiring each other. Only handles
|
|
644
|
+
# undirected (i.e., mutual) dependencies. Directed dependencies are
|
|
645
|
+
# better modeled with Optimist::die.
|
|
646
|
+
#
|
|
647
|
+
# pkg:gem/optimist#lib/optimist.rb:258
|
|
648
|
+
def depends(*syms); end
|
|
649
|
+
|
|
650
|
+
# The per-parser version of Optimist::die (see that for documentation).
|
|
651
|
+
#
|
|
652
|
+
# pkg:gem/optimist#lib/optimist.rb:553
|
|
653
|
+
def die(arg, msg = T.unsafe(nil), error_code = T.unsafe(nil)); end
|
|
654
|
+
|
|
655
|
+
# Print the help message to +stream+.
|
|
656
|
+
#
|
|
657
|
+
# pkg:gem/optimist#lib/optimist.rb:484
|
|
658
|
+
def educate(stream = T.unsafe(nil)); end
|
|
659
|
+
|
|
660
|
+
# Instead of displaying "Try --help for help." on an error
|
|
661
|
+
# display the usage (via educate)
|
|
662
|
+
#
|
|
663
|
+
# pkg:gem/optimist#lib/optimist.rb:298
|
|
664
|
+
def educate_on_error; end
|
|
665
|
+
|
|
666
|
+
# Marks two (or more!) options as required but mutually exclusive.
|
|
667
|
+
#
|
|
668
|
+
# pkg:gem/optimist#lib/optimist.rb:270
|
|
669
|
+
def either(*syms); end
|
|
670
|
+
|
|
671
|
+
# A flag that determines whether or not to raise an error if the parser is passed one or more
|
|
672
|
+
# options that were not registered ahead of time. If 'true', then the parser will simply
|
|
673
|
+
# ignore options that it does not recognize.
|
|
674
|
+
#
|
|
675
|
+
# pkg:gem/optimist#lib/optimist.rb:127
|
|
676
|
+
def ignore_invalid_options; end
|
|
677
|
+
|
|
678
|
+
# A flag that determines whether or not to raise an error if the parser is passed one or more
|
|
679
|
+
# options that were not registered ahead of time. If 'true', then the parser will simply
|
|
680
|
+
# ignore options that it does not recognize.
|
|
681
|
+
#
|
|
682
|
+
# pkg:gem/optimist#lib/optimist.rb:127
|
|
683
|
+
def ignore_invalid_options=(_arg0); end
|
|
684
|
+
|
|
685
|
+
# The values from the commandline that were not interpreted by #parse.
|
|
686
|
+
#
|
|
687
|
+
# pkg:gem/optimist#lib/optimist.rb:118
|
|
688
|
+
def leftovers; end
|
|
689
|
+
|
|
690
|
+
# Define an option. +name+ is the option name, a unique identifier
|
|
691
|
+
# for the option that you will use internally, which should be a
|
|
692
|
+
# symbol or a string. +desc+ is a string description which will be
|
|
693
|
+
# displayed in help messages.
|
|
694
|
+
#
|
|
695
|
+
# Takes the following optional arguments:
|
|
696
|
+
#
|
|
697
|
+
# [+:long+] Specify the long form of the argument, i.e. the form with two dashes. If unspecified, will be automatically derived based on the argument name by turning the +name+ option into a string, and replacing any _'s by -'s.
|
|
698
|
+
# [+:short+] Specify the short form of the argument, i.e. the form with one dash. If unspecified, will be automatically derived from +name+. Use :none: to not have a short value.
|
|
699
|
+
# [+:type+] Require that the argument take a parameter or parameters of type +type+. For a single parameter, the value can be a member of +SINGLE_ARG_TYPES+, or a corresponding Ruby class (e.g. +Integer+ for +:int+). For multiple-argument parameters, the value can be any member of +MULTI_ARG_TYPES+ constant. If unset, the default argument type is +:flag+, meaning that the argument does not take a parameter. The specification of +:type+ is not necessary if a +:default+ is given.
|
|
700
|
+
# [+:default+] Set the default value for an argument. Without a default value, the hash returned by #parse (and thus Optimist::options) will have a +nil+ value for this key unless the argument is given on the commandline. The argument type is derived automatically from the class of the default value given, so specifying a +:type+ is not necessary if a +:default+ is given. (But see below for an important caveat when +:multi+: is specified too.) If the argument is a flag, and the default is set to +true+, then if it is specified on the the commandline the value will be +false+.
|
|
701
|
+
# [+:required+] If set to +true+, the argument must be provided on the commandline.
|
|
702
|
+
# [+:multi+] If set to +true+, allows multiple occurrences of the option on the commandline. Otherwise, only a single instance of the option is allowed. (Note that this is different from taking multiple parameters. See below.)
|
|
703
|
+
# [+:permitted+] Specify an Array of permitted values for an option. If the user provides a value outside this list, an error is thrown.
|
|
704
|
+
#
|
|
705
|
+
# Note that there are two types of argument multiplicity: an argument
|
|
706
|
+
# can take multiple values, e.g. "--arg 1 2 3". An argument can also
|
|
707
|
+
# be allowed to occur multiple times, e.g. "--arg 1 --arg 2".
|
|
708
|
+
#
|
|
709
|
+
# Arguments that take multiple values should have a +:type+ parameter
|
|
710
|
+
# drawn from +MULTI_ARG_TYPES+ (e.g. +:strings+), or a +:default:+
|
|
711
|
+
# value of an array of the correct type (e.g. [String]). The
|
|
712
|
+
# value of this argument will be an array of the parameters on the
|
|
713
|
+
# commandline.
|
|
714
|
+
#
|
|
715
|
+
# Arguments that can occur multiple times should be marked with
|
|
716
|
+
# +:multi+ => +true+. The value of this argument will also be an array.
|
|
717
|
+
# In contrast with regular non-multi options, if not specified on
|
|
718
|
+
# the commandline, the default value will be [], not nil.
|
|
719
|
+
#
|
|
720
|
+
# These two attributes can be combined (e.g. +:type+ => +:strings+,
|
|
721
|
+
# +:multi+ => +true+), in which case the value of the argument will be
|
|
722
|
+
# an array of arrays.
|
|
723
|
+
#
|
|
724
|
+
# There's one ambiguous case to be aware of: when +:multi+: is true and a
|
|
725
|
+
# +:default+ is set to an array (of something), it's ambiguous whether this
|
|
726
|
+
# is a multi-value argument as well as a multi-occurrence argument.
|
|
727
|
+
# In thise case, Optimist assumes that it's not a multi-value argument.
|
|
728
|
+
# If you want a multi-value, multi-occurrence argument with a default
|
|
729
|
+
# value, you must specify +:type+ as well.
|
|
730
|
+
#
|
|
731
|
+
# pkg:gem/optimist#lib/optimist.rb:204
|
|
732
|
+
def opt(name, desc = T.unsafe(nil), opts = T.unsafe(nil), &b); end
|
|
733
|
+
|
|
734
|
+
# Parses the commandline. Typically called by Optimist::options,
|
|
735
|
+
# but you can call it directly if you need more control.
|
|
736
|
+
#
|
|
737
|
+
# throws CommandlineError, HelpNeeded, and VersionNeeded exceptions.
|
|
738
|
+
#
|
|
739
|
+
# pkg:gem/optimist#lib/optimist.rb:356
|
|
740
|
+
def parse(cmdline = T.unsafe(nil)); end
|
|
741
|
+
|
|
742
|
+
# The complete configuration hashes for each option. (Mainly useful
|
|
743
|
+
# for testing.)
|
|
744
|
+
#
|
|
745
|
+
# pkg:gem/optimist#lib/optimist.rb:122
|
|
746
|
+
def specs; end
|
|
747
|
+
|
|
748
|
+
# Defines a set of words which cause parsing to terminate when
|
|
749
|
+
# encountered, such that any options to the left of the word are
|
|
750
|
+
# parsed as usual, and options to the right of the word are left
|
|
751
|
+
# intact.
|
|
752
|
+
#
|
|
753
|
+
# A typical use case would be for subcommand support, where these
|
|
754
|
+
# would be set to the list of subcommands. A subsequent Optimist
|
|
755
|
+
# invocation would then be used to parse subcommand options, after
|
|
756
|
+
# shifting the subcommand off of ARGV.
|
|
757
|
+
#
|
|
758
|
+
# pkg:gem/optimist#lib/optimist.rb:284
|
|
759
|
+
def stop_on(*words); end
|
|
760
|
+
|
|
761
|
+
# Similar to #stop_on, but stops on any unknown word when encountered
|
|
762
|
+
# (unless it is a parameter for an argument). This is useful for
|
|
763
|
+
# cases where you don't know the set of subcommands ahead of time,
|
|
764
|
+
# i.e., without first parsing the global options.
|
|
765
|
+
#
|
|
766
|
+
# pkg:gem/optimist#lib/optimist.rb:292
|
|
767
|
+
def stop_on_unknown; end
|
|
768
|
+
|
|
769
|
+
# Adds a synopsis (command summary description) right below the
|
|
770
|
+
# usage line, or as the first line if usage isn't specified.
|
|
771
|
+
#
|
|
772
|
+
# pkg:gem/optimist#lib/optimist.rb:244
|
|
773
|
+
def synopsis(s = T.unsafe(nil)); end
|
|
774
|
+
|
|
775
|
+
# pkg:gem/optimist#lib/optimist.rb:253
|
|
776
|
+
def text(s); end
|
|
777
|
+
|
|
778
|
+
# Sets the usage string. If set the message will be printed as the
|
|
779
|
+
# first line in the help (educate) output and ending in two new
|
|
780
|
+
# lines.
|
|
781
|
+
#
|
|
782
|
+
# pkg:gem/optimist#lib/optimist.rb:238
|
|
783
|
+
def usage(s = T.unsafe(nil)); end
|
|
784
|
+
|
|
785
|
+
# Sets the version string. If set, the user can request the version
|
|
786
|
+
# on the commandline. Should probably be of the form "<program name>
|
|
787
|
+
# <version number>".
|
|
788
|
+
#
|
|
789
|
+
# pkg:gem/optimist#lib/optimist.rb:231
|
|
790
|
+
def version(s = T.unsafe(nil)); end
|
|
791
|
+
|
|
792
|
+
# pkg:gem/optimist#lib/optimist.rb:517
|
|
793
|
+
def width; end
|
|
794
|
+
|
|
795
|
+
# pkg:gem/optimist#lib/optimist.rb:539
|
|
796
|
+
def wrap(str, opts = T.unsafe(nil)); end
|
|
797
|
+
|
|
798
|
+
private
|
|
799
|
+
|
|
800
|
+
# pkg:gem/optimist#lib/optimist.rb:649
|
|
801
|
+
def collect_argument_parameters(args, start_at); end
|
|
802
|
+
|
|
803
|
+
# yield successive arg, parameter pairs
|
|
804
|
+
#
|
|
805
|
+
# pkg:gem/optimist#lib/optimist.rb:572
|
|
806
|
+
def each_arg(args); end
|
|
807
|
+
|
|
808
|
+
# pkg:gem/optimist#lib/optimist.rb:317
|
|
809
|
+
def handle_unknown_argument(arg, candidates, suggestions); end
|
|
810
|
+
|
|
811
|
+
# pkg:gem/optimist#lib/optimist.rb:531
|
|
812
|
+
def legacy_width; end
|
|
813
|
+
|
|
814
|
+
# Match long variables with inexact match.
|
|
815
|
+
# If we hit a complete match, then use that, otherwise see how many long-options partially match.
|
|
816
|
+
# If only one partially matches, then we can safely use that.
|
|
817
|
+
# Otherwise, we raise an error that the partially given option was ambiguous.
|
|
818
|
+
#
|
|
819
|
+
# pkg:gem/optimist#lib/optimist.rb:306
|
|
820
|
+
def perform_inexact_match(arg, partial_match); end
|
|
821
|
+
|
|
822
|
+
# pkg:gem/optimist#lib/optimist.rb:659
|
|
823
|
+
def resolve_default_short_options!; end
|
|
824
|
+
|
|
825
|
+
# pkg:gem/optimist#lib/optimist.rb:671
|
|
826
|
+
def wrap_line(str, opts = T.unsafe(nil)); end
|
|
827
|
+
|
|
828
|
+
class << self
|
|
829
|
+
# The Option subclasses are responsible for registering themselves using this function.
|
|
830
|
+
#
|
|
831
|
+
# pkg:gem/optimist#lib/optimist.rb:99
|
|
832
|
+
def register(lookup, klass); end
|
|
833
|
+
|
|
834
|
+
# Gets the class from the registry.
|
|
835
|
+
# Can be given either a class-name, e.g. Integer, a string, e.g "integer", or a symbol, e.g :integer
|
|
836
|
+
#
|
|
837
|
+
# pkg:gem/optimist#lib/optimist.rb:105
|
|
838
|
+
def registry_getopttype(type); end
|
|
839
|
+
end
|
|
840
|
+
end
|
|
841
|
+
|
|
842
|
+
# pkg:gem/optimist#lib/optimist.rb:129
|
|
843
|
+
Optimist::Parser::DEFAULT_SETTINGS = T.let(T.unsafe(nil), Hash)
|
|
844
|
+
|
|
845
|
+
# pkg:gem/optimist#lib/optimist.rb:727
|
|
846
|
+
class Optimist::ShortNames
|
|
847
|
+
# pkg:gem/optimist#lib/optimist.rb:731
|
|
848
|
+
def initialize; end
|
|
849
|
+
|
|
850
|
+
# pkg:gem/optimist#lib/optimist.rb:738
|
|
851
|
+
def add(values); end
|
|
852
|
+
|
|
853
|
+
# pkg:gem/optimist#lib/optimist.rb:736
|
|
854
|
+
def auto; end
|
|
855
|
+
|
|
856
|
+
# pkg:gem/optimist#lib/optimist.rb:736
|
|
857
|
+
def chars; end
|
|
858
|
+
end
|
|
859
|
+
|
|
860
|
+
# pkg:gem/optimist#lib/optimist.rb:729
|
|
861
|
+
Optimist::ShortNames::INVALID_ARG_REGEX = T.let(T.unsafe(nil), Regexp)
|
|
862
|
+
|
|
863
|
+
# Option class for handling multiple Strings
|
|
864
|
+
#
|
|
865
|
+
# pkg:gem/optimist#lib/optimist.rb:1116
|
|
866
|
+
class Optimist::StringArrayOption < ::Optimist::StringOption
|
|
867
|
+
# pkg:gem/optimist#lib/optimist.rb:1119
|
|
868
|
+
def multi_arg?; end
|
|
869
|
+
|
|
870
|
+
# pkg:gem/optimist#lib/optimist.rb:1118
|
|
871
|
+
def type_format; end
|
|
872
|
+
end
|
|
873
|
+
|
|
874
|
+
# Option class for handling Strings.
|
|
875
|
+
#
|
|
876
|
+
# pkg:gem/optimist#lib/optimist.rb:1063
|
|
877
|
+
class Optimist::StringOption < ::Optimist::Option
|
|
878
|
+
# pkg:gem/optimist#lib/optimist.rb:1065
|
|
879
|
+
def as_type(val); end
|
|
880
|
+
|
|
881
|
+
# pkg:gem/optimist#lib/optimist.rb:1067
|
|
882
|
+
def parse(paramlist, _neg_given); end
|
|
883
|
+
|
|
884
|
+
# pkg:gem/optimist#lib/optimist.rb:1066
|
|
885
|
+
def type_format; end
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
# pkg:gem/optimist#lib/optimist.rb:11
|
|
889
|
+
Optimist::VERSION = T.let(T.unsafe(nil), String)
|
|
890
|
+
|
|
891
|
+
# Thrown by Parser if the user passes in '-v' or '--version'. Handled
|
|
892
|
+
# automatically by Optimist#options.
|
|
893
|
+
#
|
|
894
|
+
# pkg:gem/optimist#lib/optimist.rb:31
|
|
895
|
+
class Optimist::VersionNeeded < ::StandardError; end
|