Sha256: d3b789fb1b7a6f93633cc4c7638693d036961e24d735e3e28584c9e381417ff3

Contents?: true

Size: 451 Bytes

Versions: 84

Compression:

Stored size: 451 Bytes

Contents

# 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

Version data entries

84 entries across 84 versions & 2 rubygems

Version Path
neetob-ud-0.2.5 lib/neetob/cli/sub_command_base.rb
neetob-0.1.2 lib/neetob/cli/sub_command_base.rb
neetob-0.1.1 lib/neetob/cli/sub_command_base.rb
neetob-0.1.0 lib/neetob/cli/sub_command_base.rb