Sha256: 6ed4db56c37992dade4e4bf8d3e0136f44d1c9c5d99909ab21322cff47763cb2

Contents?: true

Size: 618 Bytes

Versions: 9

Compression:

Stored size: 618 Bytes

Contents

require 'erb'

module Commander
  module HelpFormatter
    class Terminal < Base
      def render
        template(:help).result(ProgramContext.new(@runner).get_binding)
      end

      def render_command(command)
        template(:command_help).result(Context.new(command).get_binding)
      end

      def render_subcommand(command)
        bind = ProgramContext.new(@runner).get_binding({cmd: command})
        template(:subcommand_help).result(bind)
      end

      def template(name)
        ERB.new(File.read(File.join(File.dirname(__FILE__), 'terminal', "#{name}.erb")), nil, '-')
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
commander-openflighthpc-2.0.2 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-2.0.1 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-2.0.0 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-1.2.0 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-1.1.2 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-1.1.1 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-1.1.0 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-1.0.0 lib/commander/help_formatters/terminal.rb
commander-openflighthpc-1.0.0.pre.alpha1 lib/commander/help_formatters/terminal.rb