Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.

printExport support fish-shell #260

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# boot2docker command line management tool
[![Build Status](https://travis-ci.org/kevinbin/boot2docker-cli.svg?branch=master)](https://travis-ci.org/kevinbin/boot2docker-cli)

This tool downloads the boot2docker ISO image, creates a VirtualBox virtual
machine, sets up two networks for that virtual machine (one NAT to allow the VM
Expand Down
19 changes: 16 additions & 3 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"
"runtime"
"strings"
"time"
Expand Down Expand Up @@ -181,14 +182,26 @@ func cmdShellInit() error {
}

func printExport(socket, certPath string) {
fmt.Printf(" export DOCKER_HOST=%s\n", socket)
if filepath.Base(os.Getenv("SHELL")) == "fish" {
fmt.Printf(" set -x DOCKER_HOST %s\n", socket)
} else {
fmt.Printf(" export DOCKER_HOST=%s\n", socket)
}
if certPath == "" {
if os.Getenv("DOCKER_CERT_PATH") != "" {
fmt.Println(" unset DOCKER_CERT_PATH")
if filepath.Base(os.Getenv("SHELL")) == "fish" {
fmt.Println(" set -e DOCKER_CERT_PATH")
} else {
fmt.Println(" unset DOCKER_CERT_PATH")
}
}
} else {
// Assume Docker 1.2.0 with TLS on...
fmt.Printf(" export DOCKER_CERT_PATH=%s\n", certPath)
if filepath.Base(os.Getenv("SHELL")) == "fish" {
fmt.Printf(" set -x DOCKER_CERT_PATH %s\n", certPath)
} else {
fmt.Printf(" export DOCKER_CERT_PATH=%s\n", certPath)
}
}
}

Expand Down