Sha256: 0a62c21f8c31be69196300d399fc9fb70493008837100986da16c49263026585

Contents?: true

Size: 845 Bytes

Versions: 4

Compression:

Stored size: 845 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 = open_blog

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

4 entries across 4 versions & 1 rubygems

Version Path
runeblog-0.0.62 bin/blog
runeblog-0.0.61 bin/blog
runeblog-0.0.60 bin/blog
runeblog-0.0.59 bin/blog