-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
When generating .zshrc using printf, hooks that contain comments
followed by a single quote (e.g. # ') cause parsing issues.
This breaks shellHook definitions and results in an invalid .zshrc.
example:
shell = "zsh";
shellHook = ''
#'
''Right now .zshrc gets written with printf:
printf "%s\n" \
"export ZDOTDIR=$ZDOTDIR_" \
'source $ZDOTDIR/.zshrc' \
'${shellHook}' \
'${zshHook}' \
>$ZDOTDIR/.zshrcProposed fix
Write the file with a single-quoted heredoc so the body is taken literally, no interpolation, no format processing, no escaping games:
cat >"$ZDOTDIR/.zshrc" <<EOF
export ZDOTDIR=$ZDOTDIR_
source \$ZDOTDIR/.zshrc
\${shellHook}
\${zshHook}
EOFI know this is a bit nitpicky, but it saves folks from some very confusing failures when a hook happens to contain # '.
Happy to open a PR with tests if that helps!
Metadata
Metadata
Assignees
Labels
No labels