2 # This file is part of ranger, the console file manager. (coding: utf-8)
3 # License: GNU GPL version 3, see the file "AUTHORS" for details.
5 # =====================
6 # This embedded bash script can be executed by sourcing this file.
7 # It will cd to ranger's last location after you exit it.
8 # The first argument specifies the command to run ranger, the
9 # default is simply "ranger". (Not this file itself!)
10 # The other arguments are passed to ranger.
12 tempfile="$(mktemp -t tmp.XXXXXX)"
15 "$ranger" --choosedir="$tempfile" "${@:-$(pwd)}"
17 test -f "$tempfile" &&
18 if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
19 cd "$(cat "$tempfile")"
25 from __future__
import (absolute_import
, division
, print_function
)
29 # Need to find out whether or not the flag --clean was used ASAP,
30 # because --clean is supposed to disable bytecode compilation
31 ARGV
= sys
.argv
[1:sys
.argv
.index('--')] if '--' in sys
.argv
else sys
.argv
[1:]
32 sys
.dont_write_bytecode
= '-c' in ARGV
or '--clean' in ARGV
35 import ranger
# NOQA pylint: disable=import-self,wrong-import-position
36 sys
.exit(ranger
.main()) # pylint: disable=no-member