summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/rifle.conf19
-rwxr-xr-xranger/ext/rifle.py6
2 files changed, 17 insertions, 8 deletions
diff --git a/ranger/defaults/rifle.conf b/ranger/defaults/rifle.conf
index 15a00dae..9ee15b25 100644
--- a/ranger/defaults/rifle.conf
+++ b/ranger/defaults/rifle.conf
@@ -13,14 +13,17 @@
 #
 # Prefixing a condition with "!" will negate its result.
 # These conditions are currently supported:
-#   ext <regexp>  | The regexp matches the extension of $1
-#   mime <regexp> | The regexp matches the mime type of $1
-#   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)
-#   number <n>    | change the number of this command to n
-#   terminal      | stdin, stderr and stdout are connected to a terminal
-#   X             | $DISPLAY is not empty (i.e. Xorg runs)
+#   match <regexp> | The regexp matches $1
+#   ext <regexp>   | The regexp matches the extension of $1
+#   mime <regexp>  | The regexp matches the mime type of $1
+#   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)
+#   file           | $1 is a file
+#   directory      | $1 is a directory
+#   number <n>     | change the number of this command to n
+#   terminal       | stdin, stderr and stdout are connected to a terminal
+#   X              | $DISPLAY is not empty (i.e. Xorg runs)
 #
 # There are also pseudo-conditions which have a "side effect":
 #   flag <flags>  | Change how the program is run. See below.
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index aef6c54b..1080ecec 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -169,6 +169,12 @@ class Rifle(object):
 			return bool(re.search('^(' + argument + ')$', extension))
 		elif function == 'name':
 			return bool(re.search(argument, os.path.basename(files[0])))
+		elif function == 'match':
+			return bool(re.search(argument, files[0]))
+		elif function == 'file':
+			return os.path.isfile(files[0])
+		elif function == 'directory':
+			return os.path.isdir(files[0])
 		elif function == 'path':
 			return bool(re.search(argument, os.path.abspath(files[0])))
 		elif function == 'mime':