summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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