summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-04-27 23:49:28 +0200
committerhut <hut@lepus.uberspace.de>2015-04-27 23:49:28 +0200
commit0e75041627b086c7ae7c2d0d7532d7cdb292f783 (patch)
tree060d2a79b5b5e31f325bb1b619b805a790927ae5
parentbb85f544ebeab52832b1bc9b4cc5c40799ee195a (diff)
downloadranger-0e75041627b086c7ae7c2d0d7532d7cdb292f783.tar.gz
ext.rifle: added "env" condition to check for env. vars
-rw-r--r--ranger/config/rifle.conf1
-rwxr-xr-xranger/ext/rifle.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf
index 8e98f966..061ac5a0 100644
--- a/ranger/config/rifle.conf
+++ b/ranger/config/rifle.conf
@@ -21,6 +21,7 @@
 #   name <regexp>  | The regexp matches the basename of $1
 #   path <regexp>  | The regexp matches the absolute path of $1
 #   has <program>  | The program is installed (i.e. located in $PATH)
+#   env <variable> | The environment variable "variable" is non-empty
 #   file           | $1 is a file
 #   directory      | $1 is a directory
 #   number <n>     | change the number of this command to n
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 3f360968..55db2a54 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -232,6 +232,8 @@ class Rifle(object):
             return True
         elif function == 'X':
             return 'DISPLAY' in os.environ
+        elif function == 'env':
+            return bool(os.environ.get(argument))
         elif function == 'else':
             return True