summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-21 13:45:57 +0100
committerhut <hut@lavabit.com>2010-01-21 13:45:57 +0100
commite57c337d7530fd3cd15633f08d50c347ce5115d0 (patch)
tree37729f1757b3ca9cbcc9c4addc770816dea8329a /ranger
parent20e031cc346aab8069b8c208b216ae5f7334a509 (diff)
downloadranger-e57c337d7530fd3cd15633f08d50c347ce5115d0.tar.gz
main: added debug mode
Diffstat (limited to 'ranger')
-rw-r--r--ranger/__init__.py2
-rw-r--r--ranger/__main__.py6
-rw-r--r--ranger/actions.py3
3 files changed, 11 insertions, 0 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py
index 497e69ce..f7c10257 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -28,6 +28,8 @@ __author__ = 'hut'
 __maintainer__ = 'hut'
 __email__ = 'hut@lavabit.com'
 
+debug = False
+
 CONFDIR = os.path.expanduser('~/.ranger')
 RANGERDIR = os.path.dirname(__file__)
 
diff --git a/ranger/__main__.py b/ranger/__main__.py
index c34aa976..071b5bb8 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -31,6 +31,7 @@ def main():
 	from locale import setlocale, LC_ALL
 	from optparse import OptionParser, SUPPRESS_HELP
 
+	import ranger
 	from ranger.ext import curses_interrupt_handler
 	from ranger import __version__, USAGE, CONFDIR
 	from ranger.fm import FM
@@ -63,11 +64,16 @@ def main():
 	parser.add_option('-f', type='string', dest='flags', default='',
 			help="if a filename is supplied, run it with these flags.")
 
+	parser.add_option('-d', '--debug', action='store_true',
+			help="activate debug mode")
+
 	args, rest = parser.parse_args()
 
 	if args.cd_after_exit:
 		sys.stderr = sys.__stdout__
 	
+	ranger.debug = args.debug
+	
 	SettingsAware._setup()
 
 	# Initialize objects
diff --git a/ranger/actions.py b/ranger/actions.py
index 1463e076..f51697e3 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -16,6 +16,7 @@ import os
 import shutil
 from inspect import cleandoc
 
+import ranger
 from ranger.shared import EnvironmentAware, SettingsAware
 from ranger import fsobject
 from ranger.gui.widgets import console_mode as cmode
@@ -339,6 +340,8 @@ class Actions(EnvironmentAware, SettingsAware):
 	
 	def notify(self, text, duration=4, bad=False):
 		if isinstance(text, Exception):
+			if ranger.debug:
+				raise text
 			text = str(text)
 			bad = True
 		self.log.appendleft(text)