Sha256: 0a3f559848e9f951e73f692eb09fb81c10677578020bc5551418b1a4149aeb87
Contents?: true
Size: 1.13 KB
Versions: 9
Compression:
Stored size: 1.13 KB
Contents
#! /usr/bin/env ruby require "optparse" require_relative "../lib/nora.rb" # @return [Hash] A hash of command line options: # :weeks_ahead => How many weeks ahead to schedule # :test => True iff we're testing the script (default: false) def parsed_options options = {} parser = OptionParser.new do |opts| opts.banner = "Usage: nora --weeks-ahead <weeks>" opts.on( "--weeks-ahead <weeks>", "(required) How many weeks ahead to schedule" ) do |weeks| options[:weeks_ahead] = weeks.to_i end # Default to not using test mode options[:test] = false opts.on( "--test", "Testing mode. Does not actually schedule anything or send any emails." ) do |test| options[:test] = test end opts.on("--version", "Print the version and exit") do puts Nora::VERSION exit end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end parser.parse! if !options[:weeks_ahead] || options[:weeks_ahead] < 1 puts "Missing argument: weeks-ahead" puts parser exit end options end Nora::Core.new(parsed_options).run!
Version data entries
9 entries across 9 versions & 1 rubygems
Version | Path |
---|---|
nora-0.11 | exe/nora |
nora-0.10 | exe/nora |
nora-0.9 | exe/nora |
nora-0.8 | exe/nora |
nora-0.7 | exe/nora |
nora-0.6 | exe/nora |
nora-0.5 | exe/nora |
nora-0.4 | exe/nora |
nora-0.3 | exe/nora |