Sha256: 255dce8672710b94a586adf87659aa88cbbff13b8f25081eb84c46d73306a7c7

Contents?: true

Size: 358 Bytes

Versions: 2

Compression:

Stored size: 358 Bytes

Contents

module Docli
  class SubcommandBase < Thor
    def self.banner(command, namespace = nil, subcommand = false)
      "#{basename} #{subcommand_prefix} #{command.usage}"
    end

    def self.subcommand_prefix
      self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) { |match| match[0].downcase }.gsub(%r{[A-Z]}) { |match| "-#{match[0].downcase}" }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docli-0.0.2.pre.alpha.pre.15 lib/docli/subcommand_base.rb
docli-0.0.2.pre.alpha.pre.12 lib/docli/subcommand_base.rb