Sha256: ec0e8cc4a12d730ac081a7af155d59fed3316dc9cee6cab17e36889a0b015e7a
Contents?: true
Size: 1.06 KB
Versions: 7
Compression:
Stored size: 1.06 KB
Contents
#!/usr/bin/env ruby $: << "./lib" require 'readline' 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 if ! RuneBlog.exist? print "No blog found. Create new one? (y/n) " resp = gets.chomp if resp == "y" RuneBlog.create_new_blog else exit end end @blog = RuneBlog.new print red("\n RuneBlog v #{RuneBlog::VERSION}") if cmd.nil? # REPL puts loop do # print red("\nblog> ") # cmd = gets cmd = Readline.readline(red("\nblog> "), true) cmd_quit(nil) 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
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
runeblog-0.0.83 | bin/blog |
runeblog-0.0.82 | bin/blog |
runeblog-0.0.81 | bin/blog |
runeblog-0.0.79 | bin/blog |
runeblog-0.0.78 | bin/blog |
runeblog-0.0.77 | bin/blog |
runeblog-0.0.76 | bin/blog |