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.2 lib/neetob/cli/sub_command_base.rb
neetob-0.4.1 lib/neetob/cli/sub_command_base.rb
neetob-0.4.0 lib/neetob/cli/sub_command_base.rb
neetob-0.3.2 lib/neetob/cli/sub_command_base.rb
neetob-0.3.1 lib/neetob/cli/sub_command_base.rb
neetob-0.3.0 lib/neetob/cli/sub_command_base.rb
neetob-0.2.7 lib/neetob/cli/sub_command_base.rb
neetob-0.2.6 lib/neetob/cli/sub_command_base.rb
neetob-0.2.5 lib/neetob/cli/sub_command_base.rb
neetob-0.2.4 lib/neetob/cli/sub_command_base.rb
neetob-0.2.3 lib/neetob/cli/sub_command_base.rb
neetob-0.2.2 lib/neetob/cli/sub_command_base.rb
neetob-0.2.1 lib/neetob/cli/sub_command_base.rb
neetob-0.2.0 lib/neetob/cli/sub_command_base.rb
neetob-0.1.5 lib/neetob/cli/sub_command_base.rb
neetob-ud-0.2.14 lib/neetob/cli/sub_command_base.rb
neetob-ud-0.2.13 lib/neetob/cli/sub_command_base.rb
neetob-0.1.4 lib/neetob/cli/sub_command_base.rb
neetob-ud-0.2.11 lib/neetob/cli/sub_command_base.rb
neetob-ud-0.2.9 lib/neetob/cli/sub_command_base.rb