Sha256: 3a669c6d82cfb9e99447b0dcbdd2c089f17362f3ea7029eb1ef4b8f72aaa747a

Contents?: true

Size: 975 Bytes

Versions: 1

Compression:

Stored size: 975 Bytes

Contents

# frozen_string_literal: true

module Branch
  module Name
    module Subcommands
      # This module helps fix a bug in Thor that prohibits help for nested
      # subcommands from displaying help properly. Nested subcommands fail
      # to display their subcommand ancestor command name. This fixes that
      # bug. This module is used in conjunction with the Nestable module.
      module HelpNestable
        class << self
          def included(base)
            # Thor override
            base.desc 'help [COMMAND]', 'Describe available commands or one specific command'
            base.help_override "#{base.ancestor_name} help [SUBCOMMAND]"
            # rubocop:disable Style/OptionalBooleanParameter
            # def help(command = nil, subcommand = false)
            #   puts "subcommand: #{subcommand}"
            #   super
            # end
            # rubocop:enable Style/OptionalBooleanParameter
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
branch-name-3.2.1 lib/branch/name/subcommands/help_nestable.rb