Class: Shellpress::Thor

Inherits:
Thor
  • Object
show all
Defined in:
lib/shellpress/thor.rb

Direct Known Subclasses

CLI, Database, Plugin, Post, Theme, User, Wordpress

Constant Summary collapse

ORDER =
-1

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



4
5
6
# File 'lib/shellpress/thor.rb', line 4

def self.banner(task, namespace = nil, subcommand = false)
  "#{basename} #{self.to_s.gsub(/Shellpress::/, "").downcase} #{task.formatted_usage(self, $thor_runner, subcommand)}"
end

Instance Method Details

#help(*cmds) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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