Sha256: 4cacd4f2c12e5b35ac6608c212228272af8692ff730abe75e846e85c66c8d8ee
Contents?: true
Size: 848 Bytes
Versions: 8
Compression:
Stored size: 848 Bytes
Contents
#!/usr/bin/env ruby $: << "./lib" require 'repl' trap("INT") { } include RuneBlog::REPL def get_argv return nil if ARGV.size == 0 cmd = ARGV[0..1].join(" ") arg = ARGV[2] [cmd, arg] end ########### STDOUT.sync = true cmd, arg = get_argv @blog = RuneBlog.new puts red("\n RuneBlog v #{RuneBlog::VERSION}") if cmd.nil? # REPL puts loop do print red("\nblog> ") cmd = gets cmd_quit([]) if cmd.nil? # ^D cmd.chomp! next if cmd.empty? # CR does nothing meth, params = RuneBlog::REPL.choose_method(cmd) str = send(meth, params) puts str unless str.nil? end else # one command raise "Not working right now" file = File.open("/dev/tty") STDIN.reopen(file) # avoid ARGF dumbness meth, params = RuneBlog::Command.choose_method(cmd) parse_cmd(ARGV.join(" ")) execute_command end
Version data entries
8 entries across 8 versions & 1 rubygems