From 0e75041627b086c7ae7c2d0d7532d7cdb292f783 Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 27 Apr 2015 23:49:28 +0200 Subject: ext.rifle: added "env" condition to check for env. vars --- ranger/config/rifle.conf | 1 + ranger/ext/rifle.py | 2 ++ 2 files changed, 3 insertions(+) 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 | The regexp matches the basename of $1 # path | The regexp matches the absolute path of $1 # has | The program is installed (i.e. located in $PATH) +# env | The environment variable "variable" is non-empty # file | $1 is a file # directory | $1 is a directory # number | 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 -- cgit 1.4.1-2-gfad0