#!/usr/bin/env ruby

config = `git config -l`
user_name = `git config --get user.name`
user_name = "NONE" if user_name.length == 0
user_email = `git config --get user.email`
user_email = "NONE" if user_email.length == 0

begin
  keyfile = File.readlink(File.expand_path("~/.ssh/id_github_current"))
  project = keyfile =~ %r{id_github_(\w+)} ? $1 : "NONE"
rescue Errno::ENOENT
  project = "NONE"
end

puts "git user:       #{user_name}"
puts "git email:      #{user_email}"
puts "GitHub project: #{project}"
