about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-11-27 22:30:38 +0100
committerhut <hut@lavabit.com>2009-11-27 22:30:38 +0100
commita66c4a26f79d71210422f7d977b892d5a700dae8 (patch)
treedd131629b0b65a29396d68a7ed8ccaff8e8e048e
parentdb9bb0c9026b38acdf1174f2be5851acd47e066b (diff)
downloadranger-a66c4a26f79d71210422f7d977b892d5a700dae8.tar.gz
embedded wrapper.sh into ranger.py
-rwxr-xr-xranger.py12
-rwxr-xr-xwrapper.sh16
2 files changed, 12 insertions, 16 deletions
diff --git a/ranger.py b/ranger.py
index 2ab5ee1d..a7a1a864 100755
--- a/ranger.py
+++ b/ranger.py
@@ -1,6 +1,18 @@
 #!/usr/bin/python
 # coding=utf-8
 
+# An embedded shell script. Assuming this file is /usr/bin/ranger,
+# this hack allows you to use the cd-after-exit feature by typing:
+# source ranger ranger
+"""":
+if [ $1 ]; then
+	cd "`$1 --cd-after-exit $@ 3>&1 1>&2 2>&3 3>&-`"
+else
+	echo "use with: source path/to/ranger.py path/to/ranger.py"
+fi
+return 1
+"""
+
 import sys, os
 
 # Change the directory of the parent shell after exiting Ranger.
diff --git a/wrapper.sh b/wrapper.sh
deleted file mode 100755
index 080033c2..00000000
--- a/wrapper.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-#
-# Use this file to activate a special feature:
-# Changing the directory of the parent shell after exiting Ranger.
-# To use this, create an alias for this command in your shell config:
-#
-# source path/to/wrapper.sh path/to/ranger.py
-#
-# (This does not work with all shells, it was successfully tested
-# with bash and zsh though.)
-#
-if [ $1 ]; then
-	cd "`$1 --cd-after-exit $@ 3>&1 1>&2 2>&3 3>&-`"
-else
-	echo "use with: source path/to/wrapper.sh path/to/ranger.py"
-fi