class Snaptoken::Commands::Help

Public Class Methods

name() click to toggle source
# File lib/snaptoken/commands/help.rb, line 2
def self.name
  "help"
end
summary() click to toggle source
# File lib/snaptoken/commands/help.rb, line 6
def self.summary
  "Print out list of commands, or get help\n" +
  "on a specific command."
end
usage() click to toggle source
# File lib/snaptoken/commands/help.rb, line 11
def self.usage
  "[<command>]"
end

Public Instance Methods

run() click to toggle source
# File lib/snaptoken/commands/help.rb, line 18
def run
  if @args.empty?
    puts "Usage: leg <command> [args...]"
    puts
    puts "Commands:"
    Snaptoken::Commands::LIST.each do |cmd|
      puts "  #{cmd.name} #{cmd.usage}"
      cmd.summary.split("\n").each do |line|
        puts "      #{line}"
      end
    end
    puts
    puts "For more help on a specific command, run `leg help <command>`."
  elsif cmd = Snaptoken::Commands::LIST.find { |cmd| cmd.name == @args.first }
    cmd.new(["--help"], @config)
  else
    puts "There is no '#{@args.first}' command."
  end
end
setopts!(o) click to toggle source
# File lib/snaptoken/commands/help.rb, line 15
def setopts!(o)
end