blob: 61de9b492beef97f4d00ed7085a5962612920a39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
pub const INTEGRATION_CODE: &str = r###"# To be eval'ed in the calling shell
eval "$(
if [ -n "$XDG_RUNTIME_DIR" ]; then
runtime_dir="$XDG_RUNTIME_DIR/felix"
elif [ -n "$TMPDIR" ]; then
runtime_dir="$TMPDIR/felix"
else
runtime_dir=/tmp/felix
fi
mkdir -p "$runtime_dir"
# Clean up leftover LWD files
find "$runtime_dir" -type f -and -mmin +1 -delete
cat << EOF
fx() {
local RUNTIME_DIR="$runtime_dir"
SHELL_PID=\$\$ command fx "\$@"
if [ -f "\$RUNTIME_DIR/\$\$" ]; then
cd "\$(cat "\$RUNTIME_DIR/\$\$")"
rm "\$RUNTIME_DIR/\$\$"
fi
}
EOF
)"
"###;
|