Class: Sapling::CLI
- Inherits:
-
Object
- Object
- Sapling::CLI
- Defined in:
- lib/sapling.rb
Overview
CLI is the class for option parsing, and the gateway to the program
Instance Method Summary collapse
-
#talk(options) ⇒ Object
Option parsing, and gateway to either reading and traversing a tree, or editing/creating a tree.
Instance Method Details
#talk(options) ⇒ Object
Option parsing, and gateway to either reading and traversing a tree, or editing/creating a tree.
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/sapling.rb', line 179 def talk() opt_parser = OptionParser.new do |opt| opt. = "Usage: sapling -t FILE\n" \ "Usage: sapling -e [FILE]" opt.on_tail("-h", "--help", "Show this menu") do puts opt exit end opt.on("-t", "--talk", "Begin traversing the provided dialogue tree") do if ARGV.empty? puts opt_parser exit end unless Gardner.verify_tree(ARGV[0]) puts "\n#{opt}\n" exit end speaker = Dialogue::Speaker.new speaker.file = ARGV speaker.conversation end opt.on("-e", "--edit", "Create or edit a dialogue tree") do puts "We gonna make a tree!" end end opt_parser.parse!() if ARGV.empty? puts opt_parser exit end end |