Sha256: ac5eeaeff19c9bcdde2e4eb4d8d4d551c148a42112881f190c4fc53b1ebfcf02

Contents?: true

Size: 1.08 KB

Versions: 17

Compression:

Stored size: 1.08 KB

Contents

require 'thor'
require 'eucalypt/app'
require 'eucalypt/helpers/colorize'

module Eucalypt
  module List
    include Eucalypt::Helpers
    using Colorize

    def help(shell, subcommand = false)
      list = printable_commands(true, subcommand)
      Thor::Util.thor_classes_in(self).each do |klass|
        list += klass.printable_commands(false)
      end

      indent = 2.freeze

      list.reject! do |l|
        cmd = l.first
        (/.*help.*/.match?(cmd) && /^(?!.*(helper))/.match?(cmd)) || cmd.include?('-H')
      end
      list.map {|l| l.last.sub!(?#, '·'.colorize(:pale_blue, :bold)+'›')}

      if defined?(@package_name) && @package_name
        shell.say "#{@package_name} commands:"
      else
        shell.say
        shell.say "#{"Commands".colorize(:bold)}:"
      end

      shell.print_table(list, indent: indent, truncate: false)
      shell.say
      class_options_help(shell)

      shell.say "For more information about a specific command, use #{"eucalypt -H".colorize(:pale_blue)}."
      shell.say "Example: eucalypt -H generate scaffold".colorize(:grey)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eucalypt-0.6.1 lib/eucalypt/list.rb
eucalypt-0.6.0 lib/eucalypt/list.rb
eucalypt-0.5.4 lib/eucalypt/list.rb
eucalypt-0.5.3 lib/eucalypt/list.rb
eucalypt-0.5.2 lib/eucalypt/list.rb
eucalypt-0.5.1 lib/eucalypt/list.rb
eucalypt-0.5.0 lib/eucalypt/list.rb
eucalypt-0.4.2 lib/eucalypt/list.rb
eucalypt-0.4.1 lib/eucalypt/list.rb
eucalypt-0.4.0 lib/eucalypt/list.rb
eucalypt-0.3.5 lib/eucalypt/list.rb
eucalypt-0.3.4 lib/eucalypt/list.rb
eucalypt-0.3.3 lib/eucalypt/list.rb
eucalypt-0.3.2 lib/eucalypt/list.rb
eucalypt-0.3.1 lib/eucalypt/list.rb
eucalypt-0.3.0 lib/eucalypt/list.rb
eucalypt-0.2.2 lib/eucalypt/list.rb