Sha256: c3962a8282eab6b60446a952e4e696cf51e2009de28d9a3fc0d3fb0441e03fe4
Contents?: true
Size: 897 Bytes
Versions: 39
Compression:
Stored size: 897 Bytes
Contents
# frozen_string_literal: true # Thor with subcommands that work correctly with help class SubCommandBase < Thor # Set the subcommand banner. # rubocop:disable Style/OptionalBooleanParameter # rubocop:disable Lint/EmptyBlock def self.banner(command, _namespace = nil, _subcommand = false) subcommand = subcommand_prefix name = $PROGRAM_NAME name = ENV['TAKELAGE_TAU_TAU'] unless ENV['TAKELAGE_TAU_TAU'].nil? subcommand.gsub!(/ship\s*/) {} unless ENV['TAKELAGE_TAU_SHIP'].nil? name = File.basename(name) [name, subcommand, command.usage].reject(&:empty?).join(' ') end # rubocop:enable Lint/EmptyBlock # rubocop:enable Style/OptionalBooleanParameter # Set the subcommand prefix. def self.subcommand_prefix name.gsub(/.*::/, '') .gsub(/^[A-Z]/) { |match| match[0].downcase } .gsub(/[A-Z]/) { |match| " #{match[0].downcase}" } end end
Version data entries
39 entries across 39 versions & 1 rubygems