1
0
Fork 0
mirror of synced 2024-06-14 20:01:09 -04:00

Set prompt for sub-shells

This commit is contained in:
Tim Byrne 2017-03-30 16:30:22 -05:00
parent 1c34bc8e7f
commit 4e05be7020
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12

26
yadm
View file

@ -433,10 +433,25 @@ function encrypt() {
}
function enter() {
require_repo
echo "Entering repo"
$SHELL
echo "Leaving repo"
require_shell
require_repo
shell_opts=""
shell_path=""
if [[ "$SHELL" =~ bash$ ]]; then
shell_opts="--norc"
shell_path="\w"
elif [[ "$SHELL" =~ [cz]sh$ ]]; then
shell_opts="-f"
shell_path="%~"
fi
echo "Entering yadm repo"
yadm_prompt="yadm shell ($YADM_REPO) $shell_path > "
PROMPT="$yadm_prompt" PS1="$yadm_prompt" "$SHELL" $shell_opts
echo "Leaving yadm repo"
}
function git_command() {
@ -796,6 +811,9 @@ function require_ls() {
LS_PROGRAM=ls
fi
}
function require_shell() {
[ -x "$SHELL" ] || error_out "\$SHELL does not refer to an executable."
}
function bootstrap_available() {
[ -f "$YADM_BOOTSTRAP" ] && [ -x "$YADM_BOOTSTRAP" ] && return
return 1