Skip to content

Commit

Permalink
Add special logic for implicit keys and values
Browse files Browse the repository at this point in the history
  • Loading branch information
amorphousWaste committed Oct 25, 2022
1 parent 9e409cb commit 7d6273c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/rezplugins/shell/sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ def _bind_interactive_rez(self):
self._addline(cmd % r"\[\e[1m\]$REZ_ENV_PROMPT\[\e[0m\]")

def setenv(self, key, value):
is_implicit = key == 'REZ_USED_IMPLICIT_PACKAGES'

value = self.escape_string(
value,
is_path=self._is_pathed_key(key),
is_shell_path=self._is_shell_pathed_key(key),
is_implicit=is_implicit,
)

self._addline('export %s=%s' % (key, value))
Expand All @@ -124,9 +127,13 @@ def source(self, value):
value = self.escape_string(value)
self._addline('. %s' % value)

def escape_string(self, value, is_path=False, is_shell_path=False):
def escape_string(
self, value, is_path=False, is_shell_path=False, is_implicit=False
):
value = EscapedString.promote(value)
value = value.expanduser()
if not is_implicit:
value = value.expanduser()

result = ''

for is_literal, txt in value.strings:
Expand Down

0 comments on commit 7d6273c

Please sign in to comment.