diff options
author | hut <hut@lavabit.com> | 2010-04-07 15:50:08 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-07 15:50:08 +0200 |
commit | 8d89c6f3a7cf6b0c8abc2ff68ecc7201ac08e872 (patch) | |
tree | 610dd3acfdac10ebe1d766a779897207ea6dfb33 /ranger/__main__.py | |
parent | 55435343b142c424619e3072475ca8b3366d109c (diff) | |
parent | f45f9734d2ff9fd6b68ff6c879d5b07b0e5c7d02 (diff) | |
download | ranger-8d89c6f3a7cf6b0c8abc2ff68ecc7201ac08e872.tar.gz |
Merge branch 'devel' into newkey
Conflicts: ranger/core/actions.py ranger/defaults/keys.py ranger/ext/direction.py ranger/gui/ui.py ranger/gui/widgets/browserview.py ranger/gui/widgets/pager.py
Diffstat (limited to 'ranger/__main__.py')
-rw-r--r-- | ranger/__main__.py | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py index bd01bf4a..674ad8f6 100644 --- a/ranger/__main__.py +++ b/ranger/__main__.py @@ -29,38 +29,23 @@ def parse_arguments(): parser = OptionParser(usage=USAGE, version='ranger ' + __version__) - # Instead of using this directly, use the embedded - # shell script by running ranger with: - # source /path/to/ranger /path/to/ranger - parser.add_option('--cd-after-exit', - action='store_true', - help=SUPPRESS_HELP) - parser.add_option('-d', '--debug', action='store_true', help="activate debug mode") - parser.add_option('-c', '--clean', action='store_true', help="don't touch/require any config files. ") - - parser.add_option('-r', '--confdir', dest='confdir', type='string', - default=DEFAULT_CONFDIR, + parser.add_option('-r', '--confdir', type='string', + metavar='dir', default=DEFAULT_CONFDIR, help="the configuration directory. (%default)") - - parser.add_option('-m', '--mode', type='int', dest='mode', default=0, + parser.add_option('-m', '--mode', type='int', default=0, metavar='n', help="if a filename is supplied, run it with this mode") - - parser.add_option('-f', '--flags', type='string', dest='flags', default='', + parser.add_option('-f', '--flags', type='string', default='', + metavar='string', help="if a filename is supplied, run it with these flags.") options, positional = parser.parse_args() - arg = OpenStruct(options.__dict__, targets=positional) - arg.confdir = os.path.expanduser(arg.confdir) - if arg.cd_after_exit: - sys.stderr = sys.__stdout__ - if not arg.clean: try: os.makedirs(arg.confdir) @@ -71,9 +56,7 @@ def parse_arguments(): print("To run ranger without the need for configuration files") print("use the --clean option.") raise SystemExit() - sys.path.append(arg.confdir) - return arg def main(): @@ -100,9 +83,10 @@ def main(): if getdefaultlocale()[1] not in ('utf8', 'UTF-8'): for locale in ('en_US.utf8', 'en_US.UTF-8'): try: setlocale(LC_ALL, locale) - except: pass #sometimes there is none available though... - else: - setlocale(LC_ALL, '') + except: pass + else: break + else: setlocale(LC_ALL, '') + else: setlocale(LC_ALL, '') arg = parse_arguments() ranger.arg = arg @@ -132,7 +116,6 @@ def main(): try: my_ui = UI() my_fm = FM(ui=my_ui) - my_fm.stderr_to_out = arg.cd_after_exit # Run the file manager my_fm.initialize() @@ -142,9 +125,6 @@ def main(): # Finish, clean up if 'my_ui' in vars(): my_ui.destroy() - if arg.cd_after_exit: - try: sys.__stderr__.write(my_fm.env.cwd.path) - except: pass if __name__ == '__main__': top_dir = os.path.dirname(sys.path[0]) |