Open
Conversation
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)
raimue
reviewed
Dec 30, 2022
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 |
Member
There was a problem hiding this comment.
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.
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sets PATH and MANPATH environment variables in xonsh shell config files (
~/.config/xonsh/rc.xshor~/.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.pkgstep