class ArgParser::Option
Attributes
argument[R]
These attrs are from the manifest that is applied through constructor
param[R]
These attrs are from the manifest that is applied through constructor
Public Instance Methods
name()
click to toggle source
Returns first name as a ‘default’ one when several names given
# File lib/argparser/option.rb, line 8 def name @name ||= names.first end
names()
click to toggle source
Names of an option (short, long, etc.)
# File lib/argparser/option.rb, line 15 def names @names ||= [@name] end
synopsis()
click to toggle source
# File lib/argparser/option.rb, line 19 def synopsis s = names.map{|n| n.size == 1 ? "-#{n}" : "--#{n}"}.join(', ') s << " #{param}" if param s = "[#{s}]" if !required s << '...' if multiple s end