Sha256: b781c811bdb598aedac8197e5b5e6505083b37f7f66fe4ffdeefe614490fd5d8

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

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.version_label

    def initialize args = [], options = {}, config = {}
      super args, options, config
    end
    <%- if config[:bin] -%>

    desc "-e, [--edit]", "Edit #{<%= config[:gem_class] %>::Identity.label} settings in default editor."
    map %w(-e --edit) => :edit
    def edit
      `#{editor} $HOME/#{<%= config[:gem_class] %>::Identity.file_name}`
    end
    <%- end -%>

    desc "-v, [--version]", "Show #{<%= config[:gem_class] %>::Identity.label} version."
    map %w(-v --version) => :version
    def version
      say <%= config[:gem_class] %>::Identity.version_label
    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

2 entries across 2 versions & 1 rubygems

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