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.4.34 lib/neetob/cli/sub_command_base.rb
neetob-0.4.33 lib/neetob/cli/sub_command_base.rb
neetob-0.4.32 lib/neetob/cli/sub_command_base.rb
neetob-0.4.31 lib/neetob/cli/sub_command_base.rb
neetob-0.4.30 lib/neetob/cli/sub_command_base.rb
neetob-0.4.28 lib/neetob/cli/sub_command_base.rb
neetob-0.4.27 lib/neetob/cli/sub_command_base.rb
neetob-0.4.26 lib/neetob/cli/sub_command_base.rb
neetob-0.4.24 lib/neetob/cli/sub_command_base.rb
neetob-0.4.23 lib/neetob/cli/sub_command_base.rb
neetob-0.4.22 lib/neetob/cli/sub_command_base.rb
neetob-0.4.21 lib/neetob/cli/sub_command_base.rb
neetob-0.4.20 lib/neetob/cli/sub_command_base.rb
neetob-0.4.19 lib/neetob/cli/sub_command_base.rb
neetob-0.4.16 lib/neetob/cli/sub_command_base.rb
neetob-0.4.15 lib/neetob/cli/sub_command_base.rb
neetob-0.4.14 lib/neetob/cli/sub_command_base.rb
neetob-0.4.13 lib/neetob/cli/sub_command_base.rb
neetob-0.4.12 lib/neetob/cli/sub_command_base.rb
neetob-0.4.11 lib/neetob/cli/sub_command_base.rb