Sha256: e16012ba45afce9759fa55790cc1c8c943eb87661a5a10d832dc1bc53e063bda
Contents?: true
Size: 1.66 KB
Versions: 13
Compression:
Stored size: 1.66 KB
Contents
require "mothership/help/printer" class Mothership class << self # add command to help group def group(*names) options = if names.last.is_a? Hash names.pop else {} end Mothership::Help.add_to_group(@command, names, options) end end def default_action invoke :help end def unknown_command(name) $stderr.print "Unknown command '#{name.to_s.gsub("_", "-")}'. " $stderr.puts "See 'help' for available commands." exit_status 1 end desc "Help!" input :command, :argument => :optional input :all, :type => :boolean def help platform_is_cross = (Object::RUBY_PLATFORM =~ /darwin/i) ? true : false platform_is_windows = !platform_is_cross if platform_is_windows prefix = "" suffix = "" else prefix = "\x1B[1m\x1B[33m" suffix = "\x1B[00m" end # custom header puts "#{prefix}===========================================================#{suffix}" puts "#{prefix}* Welcome Cloulu PaaS Platform#{suffix}" puts "#{prefix}*#{suffix}" puts "#{prefix}* @author clouluteam <cloulu@sk.com>#{suffix}" puts "#{prefix}* @homepage https://cloulu.com, https://github.com/cloulu#{suffix}" puts "#{prefix}============================================================#{suffix}" puts if name = input[:command] if cmd = @@commands[name.gsub("-", "_").to_sym] Mothership::Help.command_help(cmd) else unknown_command(name) end elsif Help.has_groups? Mothership::Help.print_help_groups(@@global, input[:all]) else Mothership::Help.basic_help(@@commands, @@global) end end end
Version data entries
13 entries across 13 versions & 1 rubygems