Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'xonsh' shell to postflight #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eugenesvk
Copy link

Sets PATH and MANPATH environment variables in xonsh shell config files (~/.config/xonsh/rc.xsh or ~/.xonshrc) Due to xonsh peculiar syntax replaces a literal space separator between a command an a variable with a variable (set to space for all other shells)

I've tested the file locally by running the postinstall.sh, but not as part of the full .pkg step

Sets PATH and MANPATH environment variables in xonsh shell config files (`~/.config/xonsh/rc.xsh` or `~/.xonshrc`)
Due to xonsh peculiar syntax replaces a literal space separator between a command an a variable with a variable (set to space for all other shells)
Comment on lines -283 to +308
write_setting PATH "\"${BINPATH}:${SBINPATH}:\$PATH\""
if $IS_XONSH; then
# ↓"${ENV_COMMAND}${ENV_SEP}${1}${ASSIGN}${2}"
# "$PATH.add('${PATH_TO_ADD}' ,front=True)"
backupASSIGN=${ASSIGN}
export ASSIGN=".add('"
write_setting PATH "${SBINPATH}',front=True)"
write_setting PATH "${BINPATH}' ,front=True)"
export ASSIGN=${backupASSIGN}
else
write_setting PATH "\"${BINPATH}:${SBINPATH}:\$PATH\""
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to add the special handling for xonsh to the write_setting function and pass the shell's name as an additional parameter. This would avoid the duplication of this conditional block for each variable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would replace some of the duplication with a new variable condition in the write_setting function, and you'd have to call this function 3 times instead of 2, so will add more lines with comments to user configs, so it seems even worse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants