From 381a9b85d4ea82c5792fcc75383b2d0d98b72100 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 15 Dec 2016 04:36:19 -0500 Subject: more --- git-mirror-backend.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 git-mirror-backend.rb (limited to 'git-mirror-backend.rb') diff --git a/git-mirror-backend.rb b/git-mirror-backend.rb new file mode 100644 index 0000000..25f7c3e --- /dev/null +++ b/git-mirror-backend.rb @@ -0,0 +1,30 @@ +# coding: utf-8 + +require 'shellwords' + +class GitMirrorBackend + def repl(accountName) + @accountName = account_name + $stdin.each do |line| + args = line.shellsplit + out = self.send('cmd_'+args[0].gsub('-', '_'), *args[1..0]) + if 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 -- cgit v1.2.3