Module: OptparseLite::HelpHelper
- Included in:
- Command, Dispatcher, Help, OptParser, OptParser::Response, OptParser::UnparsedParamters, ServiceObject
- Defined in:
- lib/optparse-lite.rb,
lib/optparse-lite.rb
Instance Method Summary collapse
- #cmd(str) ⇒ Object
-
#hdr(str) ⇒ Object
(also: #code)
Codes = :green=>‘32’, :yellow=>‘33’, :bold=>‘1’, :blink=>5.
- #help_requested?(argv) ⇒ Boolean
-
#looks_like_header?(line) ⇒ Boolean
Not sure about this.
- #prefix ⇒ Object
- #txt(str) ⇒ Object
Instance Method Details
#cmd(str) ⇒ Object
325 |
# File 'lib/optparse-lite.rb', line 325 def cmd(str); str end |
#hdr(str) ⇒ Object Also known as: code
Codes = :green=>‘32’, :yellow=>‘33’, :bold=>‘1’, :blink=>5
322 |
# File 'lib/optparse-lite.rb', line 322 def hdr(str); "\e[32;m#{str}\e[0m" end |
#help_requested?(argv) ⇒ Boolean
313 314 315 |
# File 'lib/optparse-lite.rb', line 313 def help_requested?(argv) ['-h','--help','-?','help'].include? argv[0] end |
#looks_like_header?(line) ⇒ Boolean
Not sure about this. ‘lines like this:’ usually aren’t headers but maybe ‘Lines Like This:’ are. are ‘Lines like this:’ ?
318 319 320 |
# File 'lib/optparse-lite.rb', line 318 def looks_like_header? line /\A[A-Z0-9][A-Za-z]*(?:\s[A-Za-z0-9]*)*:\s*\Z/ =~ line end |
#prefix ⇒ Object
323 |
# File 'lib/optparse-lite.rb', line 323 def prefix; "#{spec.invocation_name}: " end |
#txt(str) ⇒ Object
324 |
# File 'lib/optparse-lite.rb', line 324 def txt(str); str end |