Class: Morpheus::Cli::OptionParser

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/morpheus/cli/option_parser.rb

Overview

an enhanced OptionParser not used yet, maybe ever =o

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

Returns the value of attribute footer.



10
11
12
# File 'lib/morpheus/cli/option_parser.rb', line 10

def footer
  @footer
end

Instance Method Details

#full_help_messageObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/morpheus/cli/option_parser.rb', line 18

def full_help_message
  out = ""
  #out << original_to_s
  if banner
    out << "#{banner}".sub(/\n?\z/, "\n")
  end
  if !self.to_a.empty?
    #out << "Options:\n"
    out << summarize().join("")
  end
  if footer
    # nice_footer = footer.split("\n").collect {|line| "#{summary_indent}#{line}" }.join("\n")
    nice_footer = footer
    out << "\n"
    out << "#{nice_footer}".sub(/\n?\z/, "\n")
    # out << "\n"
  end
  out
end

#original_to_sObject



12
# File 'lib/morpheus/cli/option_parser.rb', line 12

alias :original_to_s :to_s

#to_sObject



14
15
16
# File 'lib/morpheus/cli/option_parser.rb', line 14

def to_s
  full_help_message
end