Escape space in YADM_HOOK_FULL_COMMAND (#187)
Backslashes are used to escape spaces, tabs, and backslashes. This allows hooks to identify separate parameters (which are space delimited).
This commit is contained in:
parent
3b820835ab
commit
ccb75b97ea
1 changed files with 10 additions and 1 deletions
11
yadm
11
yadm
|
@ -70,7 +70,16 @@ function main() {
|
|||
require_git
|
||||
|
||||
# capture full command, for passing to hooks
|
||||
FULL_COMMAND="$*"
|
||||
# the parameters will be space delimited and
|
||||
# spaces, tabs, and backslashes will be escaped
|
||||
_tab=$'\t'
|
||||
for param in "$@"; do
|
||||
param="${param//\\/\\\\}"
|
||||
param="${param//$_tab/\\$_tab}"
|
||||
param="${param// /\\ }"
|
||||
_fc+=( "$param" )
|
||||
done
|
||||
FULL_COMMAND="${_fc[*]}"
|
||||
|
||||
# create the YADM_DIR if it doesn't exist yet
|
||||
[ -d "$YADM_DIR" ] || mkdir -p "$YADM_DIR"
|
||||
|
|
Loading…
Reference in a new issue