1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Support specifying a command after yadm enter

This commit is contained in:
Tim Byrne
2019-12-08 14:39:03 -06:00
parent 96bce8dbac
commit 32baf81b56
3 changed files with 33 additions and 9 deletions

12
yadm
View File

@@ -900,6 +900,7 @@ function encrypt() {
}
function enter() {
command="$*"
require_shell
require_repo
@@ -913,12 +914,17 @@ function enter() {
shell_path="%~"
fi
echo "Entering yadm repo"
shell_cmd=()
if [ -n "$command" ]; then
shell_cmd=('-c' "$*")
fi
[ "${#shell_cmd[@]}" -eq 0 ] && echo "Entering yadm repo"
yadm_prompt="yadm shell ($YADM_REPO) $shell_path > "
PROMPT="$yadm_prompt" PS1="$yadm_prompt" "$SHELL" $shell_opts
PROMPT="$yadm_prompt" PS1="$yadm_prompt" "$SHELL" $shell_opts "${shell_cmd[@]}"
echo "Leaving yadm repo"
[ "${#shell_cmd[@]}" -eq 0 ] && echo "Leaving yadm repo"
}
function git_command() {