Sha256: e79cf45a6f025f1fb2e386b65511eabf4c51ab4c9edfff809dc5c90b8d8173ba
Contents?: true
Size: 525 Bytes
Versions: 17
Compression:
Stored size: 525 Bytes
Contents
require 'cl/help/table' require 'cl/help/usage' class Cl class Help class Cmds < Struct.new(:ctx, :cmds) HEAD = %(Type "%s help COMMAND [SUBCOMMAND]" for more details:\n) def format [head, Table.new(list).format].join("\n") end def head HEAD % ctx.name end def list cmds.any? ? cmds.map { |cmd| format_cmd(cmd) } : [['[no commands]']] end def format_cmd(cmd) ["#{Usage.new(ctx, cmd).format}", cmd.summary] end end end end
Version data entries
17 entries across 17 versions & 1 rubygems