Sha256: b1cb59a2dafc4adf9ef8bf834d5f7559b77e78198a9b0d2a9f772239a229f48e
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
#!/usr/bin/env ruby # encoding: utf-8 require 'optparse' require 'pp' $:.push File.expand_path("../../lib", __FILE__) require 'jumping_words' options = {} optparse = OptionParser.new do|opts| #The command addes a word opts.on( '-a', '--add', 'Add the word' ) do if ARGV.empty? or ARGV.size < 2 puts 'You mast set 2 words! First is word, second is translate. Like this: "jwords -a to run: бежать"' exit else db = DbWords.new(ARGV) db.add exit end end #The command deletes the word opts.on( '-d', '--destroy', 'Delete the word' ) do if ARGV.empty? puts 'You mast set number of word!' exit else db = DbWords.new(ARGV) db.destroy exit end end #The list of words opts.on( '-l', '--list', 'List of words' ) do db = DbWords.new db.list exit end #run the application opts.on( '-s', '--start', 'Start of app' ) do db = DbWords.new app = SayWords.new(:show_message => SHOW_MESSAGE, :space_words => SPACE_WORDS, :space_interation => SPACE_INTERATION) begin app.run rescue Interrupt puts "Exiting..." end end end optparse.parse!
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jumping_words-0.2.2 | bin/jwords |
jumping_words-0.2.1 | bin/jwords |