Sha256: c8214f20c63a9d3bd8e2d83ddfed79e762ea24e97cc810cfe02d7b200f385234

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

#!/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 "<event>"
    %w(when what who where).each do |option|
      puts "\t<#{option}>#{options[option]}</#{option}>"
    end
    puts "</event>"
  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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prag_events-1.0.0 bin/prag_events
prag_events-0.0.2 bin/prag_events
prag_events-0.0.1 bin/prag_events