#!/usr/bin/env ruby HELP = "USAGE: info " info = {} `svn info`.split("\n").each {|line| line =~ /(\w+):(.*)/ info[$1.downcase] = $2.strip } info['tag'] = info['url'].split("/")[-1] info['date'] = info['date'].split(" ")[0,3].join(" ") if ARGV.length < 1 puts info.collect {|k,v| "#{k}=#{v}"}.join("\n") exit 0 end k = case ARGV[0] when /^t/ then 'tag' when /^u/ then 'url' when /^r/ then 'revision' when /^a/ then 'author' when /^d/ then 'date' else puts %Q{Unrecognized command "#{ARGV[0]}"} puts HELP exit 1 end puts info[k]