Module: Oyster
- Defined in:
- lib/oyster.rb,
lib/oyster/option.rb,
lib/oyster/options/file.rb,
lib/oyster/options/flag.rb,
lib/oyster/options/glob.rb,
lib/oyster/options/array.rb,
lib/oyster/options/float.rb,
lib/oyster/specification.rb,
lib/oyster/options/string.rb,
lib/oyster/options/integer.rb,
lib/oyster/options/shortcut.rb,
lib/oyster/options/subcommand.rb
Defined Under Namespace
Classes: ArrayOption, FileOption, FlagOption, FloatOption, GlobOption, HelpRendered, IntegerOption, Option, ShortcutOption, Specification, StringOption, SubcommandOption
Constant Summary
collapse
- LONG_NAME =
/^--([a-z\[][a-z0-9\]\-]+)$/i
- LONG_NAME_EQ =
/^--([a-z\[][a-z0-9\]\-]+=.*)$/i
- SHORT_NAME =
/^-([a-z0-9]+)$/i
- HELP_INDENT =
7
- HELP_WIDTH =
80
- STOP_FLAG =
'--'
- NEGATOR =
/^no-/
- WINDOWS =
RUBY_PLATFORM.split('-').any? { |part| part =~ /mswin\d*/i }
- ROOT =
File.expand_path('..', __FILE__)
Class Method Summary
collapse
Class Method Details
.is_name?(string) ⇒ Boolean
23
24
25
|
# File 'lib/oyster.rb', line 23
def self.is_name?(string)
!string.nil? and !!(string =~ LONG_NAME || string =~ SHORT_NAME || string == STOP_FLAG)
end
|
.spec(*args, &block) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/oyster.rb', line 16
def self.spec(*args, &block)
spec = Specification.new
spec.instance_eval(&block)
spec.flag(:help, :default => false, :desc => 'Displays this help message') unless spec.has_option?(:help)
spec
end
|