Sha256: f1700a6052c98e8549a0388e0514bc5bf7119be7fe7eb72f5e975d8bb032ea9d

Contents?: true

Size: 753 Bytes

Versions: 4

Compression:

Stored size: 753 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
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

4 entries across 4 versions & 1 rubygems

Version Path
gem_bootstrap-0.2.5 templates/lib/newgem/cli.rb
gem_bootstrap-0.2.4 templates/lib/newgem/cli.rb
gem_bootstrap-0.2.3 templates/lib/newgem/cli.rb
gem_bootstrap-0.2.2 templates/lib/newgem/cli.rb