Sha256: b4dea190bc5c46e40c2a4aeeb877c43d1918f156788f2d939ff9fefca57b24ae

Contents?: true

Size: 710 Bytes

Versions: 3

Compression:

Stored size: 710 Bytes

Contents

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.deep_symbolize_keys
      if opts[:version]
        puts "You are using <%= MiscUtils.camel_case(name) %> version #{<%= MiscUtils.camel_case(name) %>::VERSION}"
        exit
      end
      process(opts)
    end

    desc 'usage', 'Display help screen'
    def usage
      puts <<-EOS
TODO: Add your sample 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.3.2 templates/lib/newgem/cli.rb
gem_bootstrap-0.3.1 templates/lib/newgem/cli.rb
gem_bootstrap-0.3.0 templates/lib/newgem/cli.rb