Sha256: e08107b0d0bb311817edab01e959e7ce363c2c7f71be86fb325c3463d36f1a4a

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

require "yaml"
require "thor"
require "thor/actions"
require "thor_plus/actions"

module <%= config[:gem_class] %>
  # The Command Line Interface (CLI) for the gem.
  class CLI < Thor
    include Thor::Actions
    include ThorPlus::Actions

    package_name <%= config[:gem_class] %>::Identity.label

    # Initialize.
    def initialize args = [], options = {}, config = {}
      super args, options, config
    end

    desc "-v, [--version]", "Show version."
    map %w(-v --version) => :version
    def version
      say <%= config[:gem_class] %>::Identity.label_version
    end

    desc "-h, [--help=HELP]", "Show this message or get help for a command."
    map %w(-h --help) => :help
    def help task = nil
      say && super
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemsmith-5.4.0 lib/gemsmith/templates/%gem_name%/lib/%gem_name%/cli.rb.tt