Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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