xxh / xxh-shell-zsh

Use zsh wherever you go through the SSH without installation on the host.
BSD 2-Clause "Simplified" License
34 stars 16 forks source link

Parameter expansion in environment variables #14

Closed jloewe closed 2 months ago

jloewe commented 2 months ago

Is your feature request related to a problem? Please describe. When passing environment variables to a remote host, they are interpreted as strings and no parameter expansion is done.

hosts:
  "":
    +e:
        - STARSHIP_CONFIG="${XDG_CONFIG_HOME}/starship.toml"

Current behaviour:

remote ~> echo $STARSHIP_CONFIG
${XDG_CONFIG_HOME}/starship.toml

My expectation:

remote ~> echo $STARSHIP_CONFIG
/home/user/.config/starship.toml

Describe the solution you'd like

A simple solution could be to explicitly run the expansion after base64 decoding the environment variables.

https://github.com/xxh/xxh-shell-zsh/blob/c262881dd389abe2b3b15ca672c51b16d23028de/entrypoint.sh#L59

# after the line above run the parameter expansion explicitly
val=$(eval "echo \"$val\"")

For community: ⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

anki-code commented 2 months ago

Hey! PR is welcome!