Class: Bogo::Cli::Parser::OptionParser

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/bogo-cli/parser.rb

Overview

Modified option parser to include subcommand information

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#subcommandsObject

Returns the value of attribute subcommands.



81
82
83
# File 'lib/bogo-cli/parser.rb', line 81

def subcommands
  @subcommands
end

Instance Method Details

#helpObject



83
84
85
86
87
88
89
90
91
# File 'lib/bogo-cli/parser.rb', line 83

def help
  v = super
  return v if Array(subcommands).empty?
  v += "\n" + "Available Commands:\n\n"
  Array(subcommands).each do |sc|
    v += summary_indent + sc.name.to_s + "\t" + sc.description.to_s + "\n"
  end
  v + "\n" + 'See `<command> --help` for more information on a specific command.'
end