From 4ff2c1b8d4fca75078da7e36f7ec1421749b43cb Mon Sep 17 00:00:00 2001
From: Jer Noble <jer.noble@apple.com>
Date: Wed, 25 Sep 2013 16:11:39 -0700
Subject: [PATCH 1/1] Add canonicalize() function.

---
 zsh_aliases | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/zsh_aliases b/zsh_aliases
index f330702..1728fa3 100644
--- a/zsh_aliases
+++ b/zsh_aliases
@@ -74,3 +74,14 @@ function ssh-learn() {
     sed -i "" "/^$1,/d" ~/.ssh/known_hosts
     ssh-keyscan -t rsa $1 >> ~/.ssh/known_hosts
 }
+
+function canonicalize() {
+    local relpath=$( dirname $1 )
+    if [[ ! -d "$relpath" ]]; then
+        echo "$0: no such file or directory: $1"
+        return 1
+    fi
+
+    echo $(cd $relpath; pwd -P)/$(basename $1)
+    return 0
+}
-- 
2.40.1