# frozen_string_literal: true require "thor" class SubCommandBase < Thor def self.banner(command, namespace = nil, subcommand = false) "#{basename} #{subcommand_prefix} #{command.usage}" end def self.subcommand_prefix self.name .split("::")[2..-2] .map { |name| name.gsub(%r{^[A-Z]}) { |match| match[0].downcase } } .map { |name| name.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" } } .join(" ") end end