Skip to content

Commit

Permalink
Threat fish's PATH export specially
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Pfenniger committed Jul 27, 2013
1 parent d0ed0bd commit e9b1faa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shell_fish.go
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"strings"
)

type fish int
Expand Down Expand Up @@ -94,6 +95,13 @@ func (f fish) Escape(str string) string {
}

func (f fish) Export(key, value string) string {
if key == "PATH" {
command := "set -x -g PATH"
for _, path := range strings.Split(value, ":") {
command += " " + f.Escape(path)
}
return command + ";"
}
return "set -x -g " + f.Escape(key) + " " + f.Escape(value) + ";"
}

Expand Down

0 comments on commit e9b1faa

Please sign in to comment.