Sha256: 59ff62b32a18141b2f45ef649cd7d68f804d6c1a92e67461275aef82950923d8

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

require 'agile_utils'
require 'thor'
module <%= MiscUtils.camel_case(name) %>
  class CLI < Thor
    using AgileUtils::HashExt

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

2 entries across 2 versions & 1 rubygems

Version Path
gem_bootstrap-0.2.1 templates/lib/newgem/cli.rb
gem_bootstrap-0.2.0 templates/lib/newgem/cli.rb