Sha256: 5eb3fa0f02aa923ba0658eb219391fd9cd4654075045fa45cbf2b06fcdcaaeb5
Contents?: true
Size: 826 Bytes
Versions: 17
Compression:
Stored size: 826 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 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 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
17 entries across 17 versions & 1 rubygems