Sha256: 70bc243beac86ed94edc5ecacffc896cc323ec59a9835b4933c4b606a8c2b667

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

Stored size: 820 Bytes

Contents

#!/usr/bin/env ruby -wKU

require File.join(File.dirname(__FILE__), *%w[.. lib auto-emo])
require "optparse"

AUTO_EMO_VERSION = File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION]))

options = {:number => 3}

ARGV.options do |opts|
  opts.banner = "Usage:  #{File.basename($PROGRAM_NAME)} [-n poems]"
    
  opts.on("-n", "--number N", Integer, "Generate N poems (default is #{options[:number]})") do |n|
    options[:number] = n
  end
  
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end

  opts.on_tail("--version", "Show version") do
    puts AUTO_EMO_VERSION
    exit
  end
  
  begin
    opts.parse!
    
    options[:number].times do |n|
      puts AutoEmo::Poem.generate
      puts "\n\n" if n < (options[:number] - 1)
    end

  rescue
    puts opts
    exit
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
edward-auto-emo-1.0.0 bin/auto-emo
auto-emo-1.0.0 bin/auto-emo