Sha256: 36832ee5960d2ddba69ef47e612f8858f596c56769e852e2097eaa4f80a04193

Contents?: true

Size: 464 Bytes

Versions: 1

Compression:

Stored size: 464 Bytes

Contents

require 'cl/format/table'
require 'cl/format/usage'

module Cl
  class Format
    class List < Struct.new(:cmds)
      HEAD = %(Type "#{$0.split('/').last} help COMMAND [SUBCOMMAND]" for more details:\n)

      def format
        [HEAD, Format::Table.new(list).format].join("\n")
      end

      def list
        cmds.map { |cmd| format_cmd(cmd) }
      end

      def format_cmd(cmd)
        ["#{Usage.new(cmd).format}", cmd.summary]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cl-0.0.3 lib/cl/format/list.rb