1 # Frequently Asked Questions
3 ## How to use Rover to change the current directory of a shell?
5 Rover cannot change the working directory of its calling shell directly.
6 However, we can use the option `--save-cwd` to write the last visited path
7 to a temporary file. Then we can `cd` to that path from the shell itself.
9 The following shell script can be used to automate this mechanism.
10 Note that it needs to be sourced directly from the shell.
15 # Based on ranger launcher.
18 # . ./cdrover.sh [/path/to/rover]
20 tempfile="$(mktemp 2> /dev/null || printf "/tmp/rover-cwd.%s" $$)"
27 "$rover" --save-cwd "$tempfile" "$@"
29 test -f "$tempfile" &&
30 if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
31 cd "$(cat "$tempfile")"
37 ## How to open files with appropriate applications?
39 Rover doesn't have any built-in functionality to associate file types with
40 applications. This is delegated to an external tool, designated by the
41 environmental variable `$ROVER_OPEN`. This tool must be a command that
42 takes a filename as argument and runs the appropriate program, opening the
45 As an example, the following shell script may be used as `$ROVER_OPEN`:
51 # ./open.sh /path/to/file
56 *.pdf|*.xps|*.cbz|*.epub)
57 fmt="mutool draw -F txt %s | less" ;;
58 *.ogg|*.flac|*.wav|*.mp3)
62 *.c|*.h|*.sh|*.lua|*.py|*.ml|*[Mm]akefile)
68 exec sh -c "$(printf "$fmt" "\"$1\"")"