#
# Include snippet for adding our local keys to our ssh-agent.
#

def add_ssh_keys():
	""" Adds any keys found to our ssh-agent. """

	# Don't mess with SSH keys if we're using a remote agent,
    # or an agent that manages keys itself.
	try:
		if $SSH_AUTH_SOCK.startswith("/tmp"):
			return
	except KeyError:
		return

	try:
		if $SSH_AUTH_SOCK.__contains__("1password"):
			return
	except KeyError:
		return

	# Automatically add each of our SSH keys.
	for f in g`~/.ssh/id*`:
		if not f.endswith('.pub'):
			ssh-add -q @(f)


add_ssh_keys()
