cmd

package
v0.0.0-...-e607504 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 18 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const UpdateUrl = "https://api.github.com/repos/LastCallMedia/vagabond/releases"

The url to fetch releases from

Variables

View Source
var CmdDestroy = cli.Command{
	Name:            "destroy",
	Aliases:         []string{"rm"},
	Usage:           "Remove one or more docker containers",
	SkipFlagParsing: true,
	Action: func(ctx *cli.Context) {
		runAndNotifyCommand("docker-compose", append([]string{"rm"}, ctx.Args()...)...)
	},
}

Proxies a docker-compose rm command.

View Source
var CmdDiagnose = cli.Command{
	Name:   "diagnose",
	Usage:  "Run diagnostic tests on the environment",
	Action: runDiagnose,
}

Tests whether setup is completed properly

View Source
var CmdHalt = cli.Command{
	Name:    "halt",
	Aliases: []string{"stop"},
	Usage:   "Stop one or more docker containers",
	Action: func(ctx *cli.Context) {
		runAndNotifyCommand("docker-compose", append([]string{"stop"}, ctx.Args()...)...)
	},
}

Proxies a docker-compose stop command.

View Source
var CmdIp = cli.Command{
	Name:  "ip",
	Usage: "View the IP Address of the docker machine",
	Action: func(ctx *cli.Context) {
		env := config.NewEnvironment()
		runAndNotifyCommand("docker-machine", "ip", env.MachineName)
	},
}

Proxies a docker-machine ip command.

View Source
var CmdSelfUpdate = cli.Command{
	Name:   "self-update",
	Usage:  "Check for a new version of this tool",
	Action: runSelfUpdate,
}

Replaces the running binary with a new version fetched from github

View Source
var CmdSetup = cli.Command{
	Name:        "setup",
	Usage:       "Prepare the environment for use",
	Description: "Prepare the environment for the first use",
	Action:      runSetup,
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "force",
			Usage: "Force the setup actions",
		},
	},
}

Sets up the vagabond environment

View Source
var CmdSsh = cli.Command{
	Name:    "ssh",
	Aliases: []string{"exec"},
	Usage:   "Shell into a running docker container",
	Action: func(ctx *cli.Context) {
		numArgs := len(ctx.Args())
		if numArgs > 1 {
			notifyError("You may only specify a single container")
			os.Exit(1)
		}
		if numArgs < 1 {
			notifyError("You must specify a container name")
			os.Exit(1)
		}
		name := ctx.Args()[0]
		contid, err := exec.Command("docker-compose", "ps", "-q", name).Output()
		contid = bytes.TrimSpace(contid)
		if err != nil || bytes.Equal(contid, []byte("")) {
			fmt.Printf("Could not find container %s.  Are you sure it's running?\n", name)
			os.Exit(1)
		}

		notifyCommand("docker", "exec", "-it", fmt.Sprintf("$(docker-compose ps -q %s)", name), "/bin/bash")
		_ = pipeCommand("docker", "exec", "-it", string(contid), "/bin/bash")
	},
}

Emulates vagrant ssh with docker exec

View Source
var CmdStatus = cli.Command{
	Name:    "status",
	Aliases: []string{"ps"},
	Usage:   "View the status of running containers",
	Action: func(ctx *cli.Context) {
		runAndNotifyCommand("docker-compose", append([]string{"ps"}, ctx.Args()...)...)
	},
}

Proxies a docker-compose ps command.

View Source
var CmdUp = cli.Command{
	Name:  "up",
	Usage: "Start one or more docker containers",
	Action: func(ctx *cli.Context) {
		runAndNotifyCommand("docker-compose", append([]string{"up", "-d"}, ctx.Args()...)...)
	},
}

Proxies a docker-compose up command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL