Skip to content

Commit

Permalink
fix: fish PATH append/prepend gets duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
adikpb committed Jun 10, 2024
1 parent 981085b commit c333bbf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions userpath/shells.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@ def show_path_commands(cls):
class Fish(Shell):
def config(self, location, front=True):
location = ' '.join(location.split(pathsep))
head, tail = (location, '$PATH') if front else ('$PATH', location)
arg = "-" + ("p" if front else "a")

# https://github.com/fish-shell/fish-shell/issues/527#issuecomment-12436286
contents = 'set PATH {} {}'.format(head, tail)
contents = f"contains {location} $PATH; or set -gx {arg} PATH {location}"

return {path.join(self.home, '.config', 'fish', 'config.fish'): contents}
return {path.join(self.home, ".config", "fish", "config.fish"): contents}

@classmethod
def show_path_commands(cls):
Expand Down

0 comments on commit c333bbf

Please sign in to comment.