about summary refs log tree commit diff stats
path: root/ranger.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-01 00:53:06 +0100
committerhut <hut@lavabit.com>2009-12-01 00:53:06 +0100
commitf8e96a972786a2448b764cba4be88aa05d708933 (patch)
tree844b6128119ccddded9310fc0c9a2c09bcb886de /ranger.py
parent88b00cac7f412c41a745aa21221a5453e470b049 (diff)
downloadranger-f8e96a972786a2448b764cba4be88aa05d708933.tar.gz
structural improvements
Diffstat (limited to 'ranger.py')
-rwxr-xr-xranger.py55
1 files changed, 9 insertions, 46 deletions
diff --git a/ranger.py b/ranger.py
index 8a2d5967..9a2e59c1 100755
--- a/ranger.py
+++ b/ranger.py
@@ -1,5 +1,7 @@
 #!/usr/bin/python
 # coding=utf-8
+# ranger: Browse your files inside the console.
+
 
 # An embedded shell script. Assuming this file is /usr/bin/ranger,
 # this hack allows you to use the cd-after-exit feature by typing:
@@ -16,53 +18,14 @@ fi
 return 1
 """
 
-from ranger.fm import FM
-from ranger.environment import Environment
-from ranger.command import CommandList
-from ranger.conf import keys, options
-from ranger.gui.defaultui import DefaultUI as UI
-from ranger.conf.colorschemes.snow import MyColorScheme
-
-import sys, os, locale
-
-try:
-	assert sys.argv[1] == '--cd-after-exit'
-	cd_after_exit = True
-	sys.stderr = sys.stdout
-	del sys.argv[1]
-except:
-	cd_after_exit = False
-
-# TODO: Parse arguments
-
-# TODO: load config
-
-os.stat_float_times(True)
-locale.setlocale(locale.LC_ALL, 'en_US.utf8')
-
 try:
-	path = os.path.abspath('.')
-	opt = options.dummy()
-
-	env = Environment(opt)
-	commandlist = CommandList()
-	colorscheme = MyColorScheme()
-	keys.initialize_commands(commandlist)
-
-	my_ui = UI(env, commandlist, colorscheme)
-	my_fm = FM(env)
-	my_fm.feed(path, my_ui)
-	my_fm.run()
+	from ranger.main import main
 
-finally:
-	try:
-		my_ui.exit()
-	except:
-		pass
+except ImportError as errormessage:
+	print(errormessage)
+	print("To run an uninstalled copy of ranger,")
+	print("launch ranger.py in the top directory.")
 
-	if cd_after_exit:
-		try:
-			sys.__stderr__.write(env.pwd.path)
-		except:
-			pass
+else:
+	main()