Skip to content

Commit

Permalink
printExport support for fish-shell (based on boot2docker#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascamata committed Oct 17, 2014
1 parent deafc19 commit 1a3d05e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strings"
Expand Down Expand Up @@ -195,9 +196,17 @@ func printExport(socket, certPath string) {
for name, value := range exports(socket, certPath) {
if os.Getenv(name) != value {
if value == "" {
fmt.Printf(" unset %s\n", name)
if filepath.Base(os.Getenv("SHELL")) == "fish" {
fmt.Printf(" set -e %s\n", name)
} else {
fmt.Printf(" unset %s\n", name)
}
} else {
fmt.Printf(" export %s=%s\n", name, value)
if filepath.Base(os.Getenv("SHELL")) == "fish" {
fmt.Printf(" set x %s\n", name)
} else {
fmt.Printf(" export %s=%s\n", name, value)
}
}
}
}
Expand Down

0 comments on commit 1a3d05e

Please sign in to comment.