Sha256: 7fb0042d0ce6cb98ee8b814718e43a4e9fc287ae34154b902d704bdb0fb361b5
Contents?: true
Size: 817 Bytes
Versions: 14
Compression:
Stored size: 817 Bytes
Contents
class Ppl::Command::Help < Ppl::Application::Command attr_accessor :command_suite def initialize @name = "help" @description = "Show a list of commands" end def execute(input, output) @command_suite.sort_by_name max_name_length = 0 @command_suite.each do |command| name_length = command.name.length if name_length > max_name_length max_name_length = name_length end end output.line("usage: ppl <command>") output.line(nil) @command_suite.each do |command| name = command.name description = command.description if @name == name next end line = sprintf(" %-#{max_name_length}s %s", name, description) output.line(line) end output.line(nil) return true end end
Version data entries
14 entries across 14 versions & 1 rubygems