#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'prag_events' class App include Methadone::Main include Methadone::CLILogging main do %w(when what where).each do |option| help_now!("--#{option} is required") if String(options[option]) == '' end if String(options['who']) == '' error = "--who is required if you don't have it in your config file You can default this by creating ~/.prag_events.rc to contain: --- :who: Your Name, and other bio stuff here" help_now!(error) end puts "" %w(when what who where).each do |option| puts "\t<#{option}>#{options[option]}" end puts "" end on("--conference","--where CONFERENCE","Where the event will be held") on("--you" ,"--who YOUR_NAME" ,"Who is presenting") on("--talk" ,"--what TALK_TITLE" ,"Title of the talk or presentation") on("--date" ,"--when DATE" ,"When the event takes place") version PragEvents::VERSION defaults_from_config_file '.prag_events.rc' go! end