Sha256: 5f4a24d29c42b646f5f6dfb178c61de1ebe9f737a7d0dd08756074b727fc59e4
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require_relative File.join(__dir__, '../lib/rake-commander') class RakeCommander::Custom::Basic < RakeCommander namespace :examples desc 'A simple example to get started' task :basic #banner "Usage: basic:example -- [options]" option '-s', '--say [SOMETHING]', "It says 'something'", default: %q(I don't know what to "say"...) option :d, '--folder NAME', default: '.', desc: 'Source local folder', required: true option '-e', '--enviro ENV', 'The target environment to run this task', required: true option '-t', :show_time, TrueClass, desc: 'Displays the local time' option :v, :debug, TrueClass, 'Shows the parsed options' def task(*_args) if options[:v] puts 'We got these options:' pp options end puts Time.now.strftime('%d %b at %H:%M') if options[:t] puts options[:s] if options.key?(:s) end end RakeCommander.self_load Rake::Task[:'examples:basic'].invoke # ruby basic.rb -- -v -d /some/folder -t #RakeCommander::Custom::Basic.parse_options %w[--help] #RakeCommander::Custom::Basic.parse_options %w[-d]
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rake-commander-0.1.4 | examples/basic.rb |
rake-commander-0.1.2 | examples/basic.rb |