clasp-ruby 0.19.1 → 0.19.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clasp/arguments.rb +88 -48
- data/lib/clasp/cli.rb +21 -21
- data/lib/clasp/specifications.rb +26 -26
- data/lib/clasp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69caf746b37b7e16ba320e99323da8dd939d902d5f94c2e7d7911e872cfcbe01
|
4
|
+
data.tar.gz: 5618e602950f633aa11c1ecad79edcce0fcd2edc7f8686c04a42b060b6569db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a4e8557e601beee4f2730fe1535c8c8f6eae5911d587df17286799284ae717e2062c4f48030f6544b0a05124d8ddd82bee497a991b775e5d1d6917df845f6e
|
7
|
+
data.tar.gz: 569c62d78ff95828e4af59066b6b65cf13746a58cd432f0f51ba54f4f1e082ac5e71e6dc59aeb02110b73599c08da57f0cec9c24f7eaa337cccd015bc9e11e5a
|
data/lib/clasp/arguments.rb
CHANGED
@@ -61,11 +61,13 @@ module CLASP
|
|
61
61
|
# The main class for processing command-line arguments
|
62
62
|
class Arguments
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
# @!visibility private
|
67
|
-
class FlagArgument # :nodoc: all
|
64
|
+
# Class that represents a parsed flag
|
65
|
+
class FlagArgument
|
68
66
|
|
67
|
+
# @!visibility private
|
68
|
+
#
|
69
|
+
# [PRIVATE] This method is subject to changed between versions and
|
70
|
+
# should not be called directly from application code
|
69
71
|
def initialize(arg, given_index, given_name, resolved_name, argument_spec, given_hyphens, given_label, extras) # :nodoc:
|
70
72
|
|
71
73
|
@arg = arg
|
@@ -78,17 +80,26 @@ class Arguments
|
|
78
80
|
@extras = extras.nil? ? {} : extras
|
79
81
|
end
|
80
82
|
|
83
|
+
# (Integer) The command-line index of the argument
|
81
84
|
attr_reader :given_index
|
85
|
+
# (String) The given name of the argument as it appeared in the command-line
|
82
86
|
attr_reader :given_name
|
87
|
+
# (CLASP::FlagSpecification) The specification matching the argument, or +nil+
|
83
88
|
attr_reader :argument_specification
|
89
|
+
# (Integer) The number of hyphens of the argument as it appeared in the command-line
|
84
90
|
attr_reader :given_hyphens
|
91
|
+
# (String) The label of the argument as it appeared in the command-line
|
85
92
|
attr_reader :given_label
|
93
|
+
# (String) The resolved name of the argument
|
86
94
|
attr_reader :name
|
95
|
+
# (Object, Hash) The extras associated with the argument
|
87
96
|
attr_reader :extras
|
88
97
|
|
89
|
-
|
98
|
+
# [DEPRECATED] Use +argument_specification+
|
99
|
+
def argument_alias; @argument_specification; end
|
90
100
|
|
91
|
-
|
101
|
+
# (String) The string form of the flag, which is the same as +name+
|
102
|
+
def to_s
|
92
103
|
|
93
104
|
@name
|
94
105
|
end
|
@@ -113,15 +124,20 @@ class Arguments
|
|
113
124
|
eql? rhs
|
114
125
|
end
|
115
126
|
|
116
|
-
|
127
|
+
# A hash-code for this instance
|
128
|
+
def hash
|
117
129
|
|
118
130
|
@arg.hash
|
119
131
|
end
|
120
132
|
end
|
121
133
|
|
122
|
-
#
|
123
|
-
class OptionArgument
|
134
|
+
# Class that represents a parsed option
|
135
|
+
class OptionArgument
|
124
136
|
|
137
|
+
# @!visibility private
|
138
|
+
#
|
139
|
+
# [PRIVATE] This method is subject to changed between versions and
|
140
|
+
# should not be called directly from application code
|
125
141
|
def initialize(arg, given_index, given_name, resolved_name, argument_spec, given_hyphens, given_label, value, extras) # :nodoc:
|
126
142
|
|
127
143
|
@arg = arg
|
@@ -135,16 +151,25 @@ class Arguments
|
|
135
151
|
@extras = extras.nil? ? {} : extras
|
136
152
|
end
|
137
153
|
|
154
|
+
# (Integer) The command-line index of the argument
|
138
155
|
attr_reader :given_index
|
156
|
+
# (String) The given name of the argument as it appeared in the command-line
|
139
157
|
attr_reader :given_name
|
158
|
+
# (CLASP::OptionSpecification) The specification matching the argument, or +nil+
|
140
159
|
attr_reader :argument_specification
|
160
|
+
# (Integer) The number of hyphens of the argument as it appeared in the command-line
|
141
161
|
attr_reader :given_hyphens
|
162
|
+
# (String) The label of the argument as it appeared in the command-line
|
142
163
|
attr_reader :given_label
|
164
|
+
# (String) The resolved name of the argument
|
143
165
|
attr_reader :name
|
166
|
+
# (String) The value of the option
|
144
167
|
attr_reader :value
|
168
|
+
# (Object, Hash) The extras associated with the argument
|
145
169
|
attr_reader :extras
|
146
170
|
|
147
|
-
|
171
|
+
# [DEPRECATED] Use +argument_specification+
|
172
|
+
def argument_alias; @argument_specification; end
|
148
173
|
|
149
174
|
def eql?(rhs) # :nodoc:
|
150
175
|
|
@@ -166,24 +191,22 @@ class Arguments
|
|
166
191
|
eql? rhs
|
167
192
|
end
|
168
193
|
|
169
|
-
|
194
|
+
# A hash-code for this instance
|
195
|
+
def hash
|
170
196
|
|
171
197
|
@arg.hash
|
172
198
|
end
|
173
199
|
|
174
|
-
|
200
|
+
# (String) The string form of the flag, which is the same as +name+=+value+
|
201
|
+
def to_s
|
175
202
|
|
176
203
|
"#{name}=#{value}"
|
177
204
|
end
|
178
205
|
end
|
179
206
|
|
180
|
-
#:startdoc:
|
181
|
-
|
182
207
|
# ######################
|
183
208
|
# Construction
|
184
209
|
|
185
|
-
public
|
186
|
-
|
187
210
|
# Loads an instance of the class, as specified by +source+, according to the given parameters
|
188
211
|
#
|
189
212
|
# See the documentation for the ::CLASP module for examples
|
@@ -191,12 +214,12 @@ class Arguments
|
|
191
214
|
# === Signature
|
192
215
|
#
|
193
216
|
# * *Parameters:*
|
194
|
-
# - +argv
|
195
|
-
# - +source
|
196
|
-
# - +options
|
217
|
+
# - +argv+ (+Array+) The arguments array. May not be +nil+. Defaults to +ARGV+
|
218
|
+
# - +source+ (+Hash+, +IO+) The arguments specification, either as a Hash or an instance of an IO-implementing type containing a YAML specification
|
219
|
+
# - +options+ An options hash, containing any of the following options
|
197
220
|
#
|
198
221
|
# * *Options:*
|
199
|
-
# - +mutate_argv
|
222
|
+
# - +mutate_argv:+ (+Boolean+) Determines if the library should mutate +argv+. Defaults to +true+. This is essential when using CLASP in conjunction with <tt>$\<</tt>
|
200
223
|
#
|
201
224
|
def self.load(argv, source, options = {}) # :yields: An instance of +CLASP::Arguments+
|
202
225
|
|
@@ -212,8 +235,8 @@ class Arguments
|
|
212
235
|
# === Signature
|
213
236
|
#
|
214
237
|
# * *Parameters:*
|
215
|
-
# - +source
|
216
|
-
# - +options
|
238
|
+
# - +source+ (+Hash+, +IO+) The arguments specification, either as a Hash or an instance of an IO-implementing type containing a YAML specification
|
239
|
+
# - +options+ An options hash, containing any of the following options
|
217
240
|
def self.load_specifications(source, options = {}) # :yields: An array of specification instances
|
218
241
|
|
219
242
|
options ||= {}
|
@@ -331,12 +354,12 @@ class Arguments
|
|
331
354
|
# === Signature
|
332
355
|
#
|
333
356
|
# * *Parameters:*
|
334
|
-
# - +argv
|
335
|
-
# - +specifications
|
336
|
-
# - +options
|
357
|
+
# - +argv+ (+Array+) The arguments array. May not be +nil+. Defaults to +ARGV+
|
358
|
+
# - +specifications+ (+Array+) The specifications array. Defaults to +nil+. If none supplied, no aliasing will be performed
|
359
|
+
# - +options+ An options hash, containing any of the following options
|
337
360
|
#
|
338
361
|
# * *Options:*
|
339
|
-
# - +mutate_argv
|
362
|
+
# - +mutate_argv:+ (+Boolean+) Determines if the library should mutate +argv+. Defaults to +true+. This is essential when using CLASP in conjunction with <tt>$\<</tt>
|
340
363
|
#
|
341
364
|
def initialize(argv = ARGV, specifications = nil, options = {})
|
342
365
|
|
@@ -357,7 +380,7 @@ class Arguments
|
|
357
380
|
|
358
381
|
specifications = nil if specifications and specifications.empty?
|
359
382
|
|
360
|
-
flags, options, values = Arguments.
|
383
|
+
flags, options, values = Arguments.parse_(argv, specifications)
|
361
384
|
|
362
385
|
[ flags, options, values ].each do |ar|
|
363
386
|
|
@@ -394,7 +417,6 @@ class Arguments
|
|
394
417
|
@options = options.freeze
|
395
418
|
@values = values.freeze
|
396
419
|
|
397
|
-
|
398
420
|
# do argv-mutation, if required
|
399
421
|
if init_opts[:mutate_argv]
|
400
422
|
|
@@ -418,7 +440,7 @@ class Arguments
|
|
418
440
|
end
|
419
441
|
|
420
442
|
# @!visibility private
|
421
|
-
def self.
|
443
|
+
def self.parse_(argv, specifications) # :nodoc:
|
422
444
|
|
423
445
|
flags = []
|
424
446
|
options = []
|
@@ -448,12 +470,12 @@ class Arguments
|
|
448
470
|
argument_spec = nil
|
449
471
|
resolved_name = nil
|
450
472
|
|
451
|
-
(specifications || []).each do |
|
473
|
+
(specifications || []).each do |s|
|
452
474
|
|
453
|
-
if
|
475
|
+
if s.name == given_name or s.aliases.include? given_name
|
454
476
|
|
455
|
-
argument_spec =
|
456
|
-
resolved_name =
|
477
|
+
argument_spec = s
|
478
|
+
resolved_name = s.name
|
457
479
|
|
458
480
|
# need to check whether the alias is a default-option
|
459
481
|
# and, if so, expand out its name and value, and replace
|
@@ -480,10 +502,10 @@ class Arguments
|
|
480
502
|
flag_alias = nil
|
481
503
|
|
482
504
|
# special case where the flag's actual name is short form and found here
|
483
|
-
flag_alias ||= specifications.detect { |
|
505
|
+
flag_alias ||= specifications.detect { |s| s.is_a?(CLASP::FlagSpecification) && s.name == new_flag }
|
484
506
|
|
485
507
|
# if not found as a flag, look in each specifications' aliases
|
486
|
-
flag_alias ||= specifications.detect { |
|
508
|
+
flag_alias ||= specifications.detect { |s| s.aliases.include? new_flag }
|
487
509
|
|
488
510
|
if not flag_alias
|
489
511
|
|
@@ -502,9 +524,9 @@ class Arguments
|
|
502
524
|
# infinite recursion
|
503
525
|
|
504
526
|
# convert to argv and invoke
|
505
|
-
flags_argv = flag_aliases.map { |
|
527
|
+
flags_argv = flag_aliases.map { |s| s.name }
|
506
528
|
|
507
|
-
grp_flags, grp_options, grp_value = Arguments.
|
529
|
+
grp_flags, grp_options, grp_value = Arguments.parse_(flags_argv, specifications)
|
508
530
|
|
509
531
|
grp_flags.map! { |f| FlagArgument.new(arg, index, given_name, f.name, f.argument_specification, hyphens.size, given_label, argument_spec ? argument_spec.extras : nil) }
|
510
532
|
grp_options.map! { |o| OptionArgument.new(arg, index, given_name, o.name, o.argument_specification, hyphens.size, given_label, o.value, argument_spec ? argument_spec.extras : nil) }
|
@@ -552,38 +574,48 @@ class Arguments
|
|
552
574
|
end
|
553
575
|
|
554
576
|
return flags, options, values
|
555
|
-
|
556
577
|
end
|
557
578
|
|
558
579
|
# ######################
|
559
580
|
# Attributes
|
560
581
|
|
561
582
|
public
|
562
|
-
#
|
583
|
+
# (Array) a frozen array of specifications
|
563
584
|
attr_reader :specifications
|
564
585
|
|
565
586
|
# [DEPRECATED] Instead refer to +specifications+
|
566
587
|
attr_reader :aliases
|
567
588
|
|
568
|
-
#
|
589
|
+
# (Array) a frozen array of flags
|
569
590
|
attr_reader :flags
|
570
591
|
|
571
|
-
#
|
592
|
+
# (Array) a frozen array of options
|
572
593
|
attr_reader :options
|
573
594
|
|
574
|
-
#
|
595
|
+
# (Array) a frozen array of values
|
575
596
|
attr_reader :values
|
576
597
|
|
577
|
-
# the (possibly mutated) array of arguments instance passed to new
|
598
|
+
# (Array) the (possibly mutated) array of arguments instance passed to new
|
578
599
|
attr_reader :argv
|
579
600
|
|
580
|
-
# unchanged copy of the original array of arguments passed to new
|
601
|
+
# (Array) unchanged copy of the original array of arguments passed to new
|
581
602
|
attr_reader :argv_original_copy
|
582
603
|
|
583
604
|
# (String) The program name
|
584
605
|
attr_reader :program_name
|
585
606
|
|
586
|
-
#
|
607
|
+
# Finds the first unknown flag or option; +nil+ if all used
|
608
|
+
#
|
609
|
+
# === Signature
|
610
|
+
#
|
611
|
+
# * *Parameters:*
|
612
|
+
# - +options+ (Hash) options
|
613
|
+
#
|
614
|
+
# * *Options:*
|
615
|
+
# - +:specifications+ ([CLASP::Specification]) Array of specifications. If not specified, the instance's +specifications+ attribute is used
|
616
|
+
#
|
617
|
+
# === Return
|
618
|
+
# (CLASP::Arguments::OptionArgument) The first unknown option; +nil+ if none found
|
587
619
|
def find_first_unknown options = {}
|
588
620
|
|
589
621
|
option = {} if options.nil?
|
@@ -613,7 +645,10 @@ class Arguments
|
|
613
645
|
# === Signature
|
614
646
|
#
|
615
647
|
# * *Parameters:*
|
616
|
-
# - +id
|
648
|
+
# - +id+ (String, CLASP::FlagArgument) The name of a flag, or the flag itself
|
649
|
+
#
|
650
|
+
# === Return
|
651
|
+
# (CLASP::Arguments::FlagArgument) The first flag matching +id+; +nil+ if none found
|
617
652
|
def find_flag(id)
|
618
653
|
|
619
654
|
flags.each do |flag|
|
@@ -630,7 +665,10 @@ class Arguments
|
|
630
665
|
# === Signature
|
631
666
|
#
|
632
667
|
# * *Parameter:*
|
633
|
-
# - +id
|
668
|
+
# - +id+ (String, CLASP::OptionArgument) The name of a option, or the option itself
|
669
|
+
#
|
670
|
+
# === Return
|
671
|
+
# (CLASP::Arguments::OptionArgument) The first option matching +id+; +nil+ if none found
|
634
672
|
def find_option(id)
|
635
673
|
|
636
674
|
options.each do |option|
|
@@ -644,9 +682,11 @@ class Arguments
|
|
644
682
|
# #################################################################### #
|
645
683
|
# backwards-compatible
|
646
684
|
|
685
|
+
# @!visibility private
|
647
686
|
Flag = FlagArgument # :nodoc:
|
687
|
+
# @!visibility private
|
648
688
|
Option = OptionArgument # :nodoc:
|
649
|
-
end
|
689
|
+
end # class Arguments
|
650
690
|
|
651
691
|
# ######################################################################## #
|
652
692
|
# module
|
data/lib/clasp/cli.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: Command-line interface
|
6
6
|
#
|
7
7
|
# Created: 27th July 2015
|
8
|
-
# Updated:
|
8
|
+
# Updated: 19th April 2019
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/CLASP.Ruby
|
11
11
|
#
|
@@ -114,17 +114,17 @@ end # module CLI_helpers_
|
|
114
114
|
# === Signature
|
115
115
|
#
|
116
116
|
# * *Parameters:*
|
117
|
-
# - +specifications
|
118
|
-
# - +options
|
117
|
+
# - +specifications+ (+Array+) The arguments array. May not be +nil+. Defaults to +ARGV+.
|
118
|
+
# - +options+ An options hash, containing any of the following options.
|
119
119
|
#
|
120
120
|
# * *Options:*
|
121
|
-
# - +:exit
|
122
|
-
# - +:program_name
|
123
|
-
# - +:stream
|
124
|
-
# - +:suppress_blank_lines_between_options
|
125
|
-
# - +:values
|
126
|
-
# - +:flags_and_options
|
127
|
-
# - +:info_lines
|
121
|
+
# - +:exit+ a program exit code; <tt>exit()</tt> not called if not specified (or +nil+).
|
122
|
+
# - +:program_name+ program name; inferred from <tt>$0</tt> if not specified.
|
123
|
+
# - +:stream+ output stream; <tt>$stdout</tt> if not specified.
|
124
|
+
# - +:suppress_blank_lines_between_options+ does exactly what it says on the tin.
|
125
|
+
# - +:values+ appends this string to USAGE line if specified.
|
126
|
+
# - +:flags_and_options+ inserts a custom string instead of the default string <tt>'[ ... flags and options ... ]'</tt>.
|
127
|
+
# - +:info_lines+ inserts 0+ information lines prior to the usage.
|
128
128
|
def self.show_usage specifications, options={}
|
129
129
|
|
130
130
|
options ||= {}
|
@@ -255,19 +255,19 @@ end
|
|
255
255
|
# === Signature
|
256
256
|
#
|
257
257
|
# * *Parameters:*
|
258
|
-
# - +specifications
|
259
|
-
# - +options
|
258
|
+
# - +specifications+ (+Array+) The arguments array. May not be +nil+. Defaults to +ARGV+.
|
259
|
+
# - +options+ An options hash, containing any of the following options.
|
260
260
|
#
|
261
261
|
# * *Options:*
|
262
|
-
# - +:exit
|
263
|
-
# - +:program_name
|
264
|
-
# - +:stream
|
265
|
-
# - +:version
|
266
|
-
# - +:version_major
|
267
|
-
# - +:version_minor
|
268
|
-
# - +:version_revision
|
269
|
-
# - +:version_build
|
270
|
-
# - +:version_prefix
|
262
|
+
# - +:exit+ a program exit code; <tt>exit()</tt> not called if not specified (or +nil+).
|
263
|
+
# - +:program_name+ program name; inferred from <tt>$0</tt> if not specified.
|
264
|
+
# - +:stream+ output stream; <tt>$stdout</tt> if not specified.
|
265
|
+
# - +:version+ an array (of N elements, each of which will be separated by a period '.'), or a string. Must be specified if not +:version_major+.
|
266
|
+
# - +:version_major+ a number or string. Only considered and must be specified if +:version+ is not.
|
267
|
+
# - +:version_minor+ a number or string. Only considered if +:version+ is not.
|
268
|
+
# - +:version_revision+ a number or string. Only considered if +:version+ is not.
|
269
|
+
# - +:version_build+ a number or string. Only considered if +:version+ is not.
|
270
|
+
# - +:version_prefix+ optional string to prefix the version number(s).
|
271
271
|
def self.show_version specifications, options = {}
|
272
272
|
|
273
273
|
options ||= {}
|
data/lib/clasp/specifications.rb
CHANGED
@@ -65,10 +65,10 @@ class FlagSpecification
|
|
65
65
|
# === Signature
|
66
66
|
#
|
67
67
|
# * *Parameters*
|
68
|
-
# - +name
|
69
|
-
# - +aliases
|
70
|
-
# - +help
|
71
|
-
# - +extras
|
68
|
+
# - +name+ (+String+) The name, or long-form, of the flag
|
69
|
+
# - +aliases+ (+Array+) 0 or more strings specifying short-form or option-value aliases
|
70
|
+
# - +help+ (+String+) The help string, which may be +nil+
|
71
|
+
# - +extras+ An application-defined additional parameter. If +nil+, it is assigned an empty +Hash+
|
72
72
|
def initialize(name, aliases, help, extras = nil)
|
73
73
|
|
74
74
|
@name = name
|
@@ -161,14 +161,14 @@ class OptionSpecification
|
|
161
161
|
# === Signature
|
162
162
|
#
|
163
163
|
# * *Parameters*
|
164
|
-
# - +name
|
165
|
-
# - +aliases
|
166
|
-
# - +help
|
167
|
-
# - +values_range
|
168
|
-
# - +default_value
|
169
|
-
# - +required
|
170
|
-
# - +required_message
|
171
|
-
# - +extras
|
164
|
+
# - +name+ (+String+) The name, or long-form, of the option
|
165
|
+
# - +aliases+ (+Array+) 0 or more strings specifying short-form or option-value aliases
|
166
|
+
# - +help+ (+String+) The help string, which may be +nil+
|
167
|
+
# - +values_range+ (+Array+) 0 or more strings specifying values supported by the option
|
168
|
+
# - +default_value+ (+String+) The default value of the option. May be +nil+
|
169
|
+
# - +required+ (boolean) Whether the option is required. May be +nil+
|
170
|
+
# - +required_message+ (::String) Message to be used when reporting that a required option is missing. May be +nil+ in which case a message of the form "<option-name> not specified; use --help for usage". If begins with the nul character ("\0"), then is used in the place of the <option-name> and placed into the rest of the standard form message
|
171
|
+
# - +extras+ An application-defined additional parameter. If +nil+, it is assigned an empty +Hash+
|
172
172
|
def initialize(name, aliases, help, values_range, default_value, required, required_message, extras = nil)
|
173
173
|
|
174
174
|
@name = name
|
@@ -301,14 +301,14 @@ end
|
|
301
301
|
# === Signature
|
302
302
|
#
|
303
303
|
# * *Parameters:*
|
304
|
-
# - +name
|
305
|
-
# - +options
|
304
|
+
# - +name+ (::String) The flag name, e.g. '--verbose'
|
305
|
+
# - +options+ (::Hash) An options hash, containing any of the following options:
|
306
306
|
#
|
307
307
|
# * *Options:*
|
308
|
-
# - +:alias+
|
309
|
-
# - +:aliases+
|
308
|
+
# - +:alias+ (::String) An alias, e.g. '-v'
|
309
|
+
# - +:aliases+ (::Array) An array of aliases, e.g. [ '-v', '-verb' ]. Ignored if +:alias+ is specified
|
310
310
|
# - +:extras+ An application-defined object, usually a hash of custom attributes
|
311
|
-
# - +:help+
|
311
|
+
# - +:help+ (::String) A help string
|
312
312
|
def CLASP.Flag(name, options = {})
|
313
313
|
|
314
314
|
aliases = nil
|
@@ -351,20 +351,20 @@ end
|
|
351
351
|
# === Signature
|
352
352
|
#
|
353
353
|
# * *Parameters:*
|
354
|
-
# - +name
|
355
|
-
# - +options
|
354
|
+
# - +name+ (::String) The flag name, e.g. '--verbose'
|
355
|
+
# - +options+ (::Hash) An options hash, containing any of the following options:
|
356
356
|
#
|
357
357
|
# * *Options:*
|
358
|
-
# - +:alias+
|
359
|
-
# - +:aliases+
|
358
|
+
# - +:alias+ (::String) An alias, e.g. '-v'
|
359
|
+
# - +:aliases+ (::Array) An array of aliases, e.g. [ '-v', '-verb' ]. Ignored if +:alias+ is specified
|
360
360
|
# - +:default_value+ The default value for the option
|
361
361
|
# - +:default+ [DEPRECATED] Alternative to +:default_value+
|
362
362
|
# - +:extras+ An application-defined object, usually a hash of custom attributes
|
363
|
-
# - +:help+
|
364
|
-
# - +required
|
365
|
-
# - +required_message
|
366
|
-
# - +extras
|
367
|
-
# - +:values_range+
|
363
|
+
# - +:help+ (::String) A help string
|
364
|
+
# - +required+ (boolean) Whether the option is required. May be +nil+
|
365
|
+
# - +required_message+ (::String) Message to be used when reporting that a required option is missing. May be +nil+ in which case a message of the form "<option-name> not specified; use --help for usage". If begins with the nul character ("\0"), then is used in the place of the <option-name> and placed into the rest of the standard form message
|
366
|
+
# - +extras+ An application-defined additional parameter. If +nil+, it is assigned an empty +Hash+.
|
367
|
+
# - +:values_range+ (::Array) An array defining the accepted values for the option
|
368
368
|
# - +:values+ [DEPRECATED] Alternative to +:values_range+
|
369
369
|
def CLASP.Option(name, options = {})
|
370
370
|
|
data/lib/clasp/version.rb
CHANGED