Set prompt for sub-shells
This commit is contained in:
parent
1c34bc8e7f
commit
4e05be7020
1 changed files with 22 additions and 4 deletions
24
yadm
24
yadm
|
@ -433,10 +433,25 @@ function encrypt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function enter() {
|
function enter() {
|
||||||
|
require_shell
|
||||||
require_repo
|
require_repo
|
||||||
echo "Entering repo"
|
|
||||||
$SHELL
|
shell_opts=""
|
||||||
echo "Leaving repo"
|
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() {
|
function git_command() {
|
||||||
|
@ -796,6 +811,9 @@ function require_ls() {
|
||||||
LS_PROGRAM=ls
|
LS_PROGRAM=ls
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
function require_shell() {
|
||||||
|
[ -x "$SHELL" ] || error_out "\$SHELL does not refer to an executable."
|
||||||
|
}
|
||||||
function bootstrap_available() {
|
function bootstrap_available() {
|
||||||
[ -f "$YADM_BOOTSTRAP" ] && [ -x "$YADM_BOOTSTRAP" ] && return
|
[ -f "$YADM_BOOTSTRAP" ] && [ -x "$YADM_BOOTSTRAP" ] && return
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue