summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-04-13 15:23:46 +0200
committerhut <hut@lavabit.com>2012-04-13 15:23:46 +0200
commit8e63339d1efcef454d5ab1a2b5b93b89a815e8ff (patch)
tree935a1f456fbdded604e0ca808f4ab81ca13ab321
parentb5134f71ccb8edf8ba9b6c2e7f328a1b96625bf4 (diff)
downloadranger-8e63339d1efcef454d5ab1a2b5b93b89a815e8ff.tar.gz
ext.rifle: a little restructuring
-rwxr-xr-xranger/ext/rifle.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index c5fafb48..c97b360d 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -122,39 +122,40 @@ class Rifle(object):
 		# This function evaluates the condition, after _eval_condition() handled
 		# negation of conditions starting with a "!".
 
-		function = rule[0]
-		argument = rule[1] if len(rule) > 1 else ''
 		if not files:
 			return False
 
+		function = rule[0]
+		argument = rule[1] if len(rule) > 1 else ''
+
 		if function == 'ext':
 			extension = os.path.basename(files[0]).rsplit('.', 1)[-1]
 			return bool(re.search('^(' + argument + ')$', extension))
-		if function == 'name':
+		elif function == 'name':
 			return bool(re.search(argument, os.path.basename(files[0])))
-		if function == 'path':
+		elif function == 'path':
 			return bool(re.search(argument, os.path.abspath(files[0])))
-		if function == 'mime':
+		elif function == 'mime':
 			return bool(re.search(argument, self._get_mimetype(files[0])))
-		if function == 'has':
+		elif function == 'has':
 			return argument in get_executables()
-		if function == 'terminal':
+		elif function == 'terminal':
 			return _is_terminal()
-		if function == 'number':
+		elif function == 'number':
 			if argument.isdigit():
 				self._skip = int(argument)
 			return True
-		if function == 'label':
+		elif function == 'label':
 			self._app_label = argument
 			if label:
 				return argument == label
 			return True
-		if function == 'flag':
+		elif function == 'flag':
 			self._app_flags = argument
 			return True
-		if function == 'X':
+		elif function == 'X':
 			return 'DISPLAY' in os.environ
-		if function == 'else':
+		elif function == 'else':
 			return True
 
 	def _get_mimetype(self, fname):