# coding: utf-8 require 'shellwords' class GitMirrorBackend def repl(accountName) @accountName = accountName $stdin.each do |line| args = line.shellsplit args[0] = 'cmd_'+args[0].gsub('-', '_') out = self.send(*args) if out.nil? # do nothing elsif out.is_a? String puts out elsif out.is_a? Array out.each do |outline| puts outline end elsif out.is_a? Hash out.each do |k,v| puts "#{k}=#{v}" end else raise "I don't know what to do with output value: #{out}" end end self.finish end def finish # noop end end