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-0.5.16 lib/neetob/cli/sub_command_base.rb
neetob-0.5.15 lib/neetob/cli/sub_command_base.rb
neetob-0.5.14 lib/neetob/cli/sub_command_base.rb
neetob-0.5.13 lib/neetob/cli/sub_command_base.rb
neetob-0.5.12 lib/neetob/cli/sub_command_base.rb
neetob-0.5.11 lib/neetob/cli/sub_command_base.rb
neetob-0.5.10 lib/neetob/cli/sub_command_base.rb
neetob-0.5.9 lib/neetob/cli/sub_command_base.rb
neetob-0.5.8 lib/neetob/cli/sub_command_base.rb
neetob-0.5.7 lib/neetob/cli/sub_command_base.rb
neetob-0.5.6 lib/neetob/cli/sub_command_base.rb
neetob-0.5.5 lib/neetob/cli/sub_command_base.rb
neetob-0.5.4 lib/neetob/cli/sub_command_base.rb
neetob-0.5.3 lib/neetob/cli/sub_command_base.rb
neetob-0.5.2 lib/neetob/cli/sub_command_base.rb
neetob-0.5.1 lib/neetob/cli/sub_command_base.rb
neetob-0.5.0 lib/neetob/cli/sub_command_base.rb
neetob-0.4.37 lib/neetob/cli/sub_command_base.rb
neetob-0.4.36 lib/neetob/cli/sub_command_base.rb
neetob-0.4.35 lib/neetob/cli/sub_command_base.rb