102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/cryptoquotes.rb', line 102
def run( args )
opts = { n: 1 }
parser = OptionParser.new do |cmd|
cmd.banner = "Usage: oracle [options]"
cmd.separator " Print wise oracle sayings / crypto quotes"
cmd.separator ""
cmd.separator " Options:"
cmd.on("-n", "--number=NUM", "Number of quotes to print (default: #{opts[:n]})", Integer ) do |num|
opts[:n] = num
end
cmd.on("-h", "--help", "Prints this help") do
puts cmd
exit
end
end
parser.parse!( args )
n = opts[:n]
n.times { Oracle.say }
end
|