class Shellpress::Thor

Constants

ORDER

Public Class Methods

banner(task, namespace = nil, subcommand = false) click to toggle source

Public Instance Methods

help(*cmds) click to toggle source
Calls superclass method
# File lib/shellpress/thor.rb, line 18
def help(*cmds)
  klass = self.class
  pref = prefix(klass).downcase

  if cmds[0]
    # Subcommand
    super(*cmds)
  else
    say "#{suffix(klass)} commands:"
    tasks = klass.printable_tasks.reject { |task| task[0] =~ /^#{pref} #{suffix(klass).downcase} help/ }
    print_table(tasks, :ident => 2)
  end

  say
end
prefix(s) click to toggle source
# File lib/shellpress/thor.rb, line 9
def prefix(s)
  s.to_s.gsub(/::.+/, "")
end
suffix(s) click to toggle source
# File lib/shellpress/thor.rb, line 13
def suffix(s)
  s.to_s.gsub(/.+?::/, "")
end