Sha256: e07dd5e06732ec9381a667b0f2bd92fb4b738f5d3f0cfbb3c5e5475ec78ca47b
Contents?: true
Size: 1.27 KB
Versions: 5
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true require_relative 'thor_nested_subcommand/version' # The main namespace for the thor_nested_subcommand gem. module ThorNestedSubcommand # This module fixes 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. class << self def included(base) base.extend ClassMethods end end module ClassMethods def base_usage raise NotImplementedError end # Thor override # rubocop:disable Style/OptionHash def desc(usage, description, options = {}) super("#{base_usage} #{usage} ", description, options) end # rubocop:enable Style/OptionHash # Thor override # rubocop:disable Style/GlobalVars # rubocop:disable Lint/UnusedMethodArgument # rubocop:disable Style/OptionalBooleanParameter def banner(command, namespace = nil, subcommand = false) command.formatted_usage(self, $thor_runner, subcommand).split("\n").map do |_formatted_usage| "#{basename} #{command.usage}" end.join("\n") end # rubocop:enable Style/GlobalVars # rubocop:enable Lint/UnusedMethodArgument # rubocop:enable Style/OptionalBooleanParameter end end
Version data entries
5 entries across 5 versions & 1 rubygems