Module: CSD::Extensions::Core::OptionParser

Included in:
OptionParser
Defined in:
lib/csd/extensions/core/option_parser.rb

Overview

This module comprises extensions to OptionParser objects.

Instance Method Summary collapse

Instance Method Details

#headline(text) ⇒ Object

Inserts a new line and a headline to the options help output.



20
21
22
23
# File 'lib/csd/extensions/core/option_parser.rb', line 20

def headline(text)
  newline
  separator(text)
end

#list_item(item = '', description = '') ⇒ Object

This method creates a line with two columns. The item will be in the first column and be indented. The description will be in the second column.

Examples

OptionParser.new do |opts|
  opts.headline 'List of Applications'
  opts.list_item 'MiniSIP', 'An open-source high-definition video conferencing client.'
  opts.list_item 'OpenSIP', 'An open-source SIP server.'

end



42
43
44
# File 'lib/csd/extensions/core/option_parser.rb', line 42

def list_item(item='', description='')
  separator(summary_indent + item.ljust(summary_width + 1) + description)
end

#newlineObject

Inserts a new line to the options help output.



14
15
16
# File 'lib/csd/extensions/core/option_parser.rb', line 14

def newline
  separator ''
end

#subheadline(text) ⇒ Object

Inserts an indented headline to the options help output.



27
28
29
# File 'lib/csd/extensions/core/option_parser.rb', line 27

def subheadline(text)
  separator(@summary_indent + text)
end