From ce2bc314e2ad49e46e422fdf8ef66d5b4275f461 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 23 Oct 2014 10:16:05 -0600 Subject: [PATCH] Make "socket" an alias of "shellinit" and hide it from usage --- cmds.go | 23 ----------------------- config.go | 5 ++--- main.go | 4 +--- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/cmds.go b/cmds.go index 3ea5875..03f9ed0 100644 --- a/cmds.go +++ b/cmds.go @@ -349,29 +349,6 @@ func cmdStatus() error { return nil } -// tell the User the Docker socket to connect to -func cmdSocket() error { - m, err := driver.GetMachine(&B2D) - if err != nil { - return fmt.Errorf("Failed to get machine %q: %s", B2D.VM, err) - } - - if m.GetState() != driver.Running { - return fmt.Errorf("VM %q is not running.", B2D.VM) - } - - socket, err := RequestSocketFromSSH(m) - if err != nil { - return fmt.Errorf("Error requesting socket: %s\n", err) - } - - fmt.Fprintf(os.Stderr, "\n\t export DOCKER_HOST=") - fmt.Printf("%s", socket) - fmt.Fprintf(os.Stderr, "\n\n") - - return nil -} - // Call the external SSH command to login into boot2docker VM. func cmdSSH() error { m, err := driver.GetMachine(&B2D) diff --git a/config.go b/config.go index 48436bb..b9b96a8 100644 --- a/config.go +++ b/config.go @@ -171,7 +171,7 @@ func config() (*flag.FlagSet, error) { } func usageShort() { - fmt.Fprintf(os.Stderr, "Usage: %s [] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|socket|shellinit|delete|download|upgrade|version} []\n", os.Args[0]) + fmt.Fprintf(os.Stderr, "Usage: %s [] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|shellinit|delete|download|upgrade|version} []\n", os.Args[0]) } func usageLong(flags *flag.FlagSet) { @@ -193,8 +193,7 @@ Commands: config|cfg Show selected profile file settings. info Display detailed information of VM. ip Display the IP address of the VM's Host-only network. - socket Display the DOCKER_HOST socket to connect to. - shellinit Display the shell command to set up the Docker client. + shellinit Display the shell commands to set up the Docker client. status Display current state of VM. download Download Boot2Docker ISO image. upgrade Upgrade the Boot2Docker ISO image (restart if running). diff --git a/main.go b/main.go index d062da2..a4f90dd 100644 --- a/main.go +++ b/main.go @@ -65,9 +65,7 @@ func run() error { return cmdDelete() case "info": return cmdInfo() - case "socket": - return cmdSocket() - case "shellinit": + case "shellinit", "socket": return cmdShellInit() case "status": return cmdStatus()