Sha256: 586e8c2b808f2d3b9e0044ecb2b2a0bf18b934a7efbecf5774c32bb8db9f822c

Contents?: true

Size: 747 Bytes

Versions: 3

Compression:

Stored size: 747 Bytes

Contents

require 'thor'
module <%= MiscUtils.camel_case(name) %>
  class CLI < Thor
    desc 'execute', 'Execute the main program'
    method_option 'version',
                  aliases: '-v',
                  desc: 'Display version number'
    def execute
      opts = options.symbolize_keys
      if opts[:version]
        puts "You are using <%= MiscUtils.camel_case(name) %> version #{<%= MiscUtils.camel_case(name) %>::VERSION}"
        exit
      end
      puts "Your options #{opts}"
      process(opts)
    end

    desc 'usage', 'Display help screen'
    def usage
      puts <<-EOS
Add you simple usage here!
      EOS
    end

    default_task :usage

    private

    def process(opts = {})
      puts "Your options #{opts}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gem_bootstrap-0.1.0 templates/lib/newgem/cli.rb
gem_bootstrap-0.0.2.pre templates/lib/newgem/cli.rb
gem_bootstrap-0.0.1 templates/lib/newgem/cli.rb