44edb3ed607389525edae4c2c0160747b05b56bf

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #1278 from bitboxer/forklift

new forklift plugin

Diff

 1diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..056069d36211daa345cf245105fbfe1ee104c993
 4--- /dev/null
 5+++ b/plugins/forklift/forklift.plugin.zsh
 6@@ -0,0 +1,44 @@
 7+# Open folder in ForkLift.app from console
 8+# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
 9+#
10+# Usage:
11+#   fl [<folder>]
12+#
13+# Opens specified directory or current working directory in ForkLift.app
14+#
15+# Notes:
16+# It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new
17+# app window.
18+#
19+# https://gist.github.com/3313481
20+function fl {
21+  if [ ! -z "$1" ]; then
22+    DIR=$1
23+    if [ ! -d "$DIR" ]; then
24+      DIR=$(dirname $DIR)
25+    fi
26+    if [ "$DIR" != "." ]; then
27+      PWD=`cd "$DIR";pwd`
28+    fi
29+  fi
30+  osascript 2>&1 1>/dev/null <<END
31+    tell application "ForkLift"
32+      activate
33+    end tell
34+    tell application "System Events"
35+      tell application process "ForkLift"
36+        try
37+          set topWindow to window 1
38+        on error
39+          keystroke "n" using command down
40+          set topWindow to window 1
41+        end try
42+        keystroke "g" using {command down, shift down}
43+        tell sheet 1 of topWindow
44+          set value of text field 1 to "$PWD"
45+        	keystroke return
46+        end tell
47+      end tell
48+    end tell
49+END
50+}