cmd

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildCommand = cli.Command{
	Name:    "build",
	Aliases: []string{"b"},
	Usage:   "Build docker images",
	Description: `Build docker images.
If environment name is not specified current branch name is used.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "start a single service",
		},
		&cli.BoolFlag{
			Name:  "no-cache",
			Usage: "do not use cache when building the image",
		},
	},
	Action: buildAction,
}
View Source
var CleanupCommand = cli.Command{
	Name:        "cleanup",
	Usage:       "Removes all projects",
	Description: `Removes projects and images for this repository. Only images associated with existing projects will be removed.`,
	Action:      cleanupAction,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "with-images",
			Aliases: []string{"i", "include-images"},
			Usage:   "also remove images",
		},
	},
}
View Source
var CodeCommand = cli.Command{
	Name:      "code",
	Aliases:   []string{"open"},
	ArgsUsage: "[DIR]",
	Usage:     "Open code editor",
	Description: `Open code editor for the project and attach to the container.
Directory is optional. By default it will open the / directory.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "start a single service",
		},
	},
	Action: codeAction,
}
View Source
var InfoCommand = cli.Command{
	Name:        "info",
	Aliases:     []string{"config", "show"},
	Usage:       "Show configuration",
	Description: `Show docker env configratuion.`,
	Action:      infoAction,
}
View Source
var ListCommand = cli.Command{
	Name:        "ls",
	Aliases:     []string{"list", "l", "ll"},
	Usage:       "List projects, 'll' to show containers.",
	Description: `List docker projects and containers.`,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "containers",
			Aliases: []string{"c"},
			Usage:   "show containers",
		},
		&cli.BoolFlag{
			Name:    "running",
			Aliases: []string{"r"},
			Usage:   "show only running projects",
		},
	},
	Action: listAction,
}
View Source
var LogsCommand = cli.Command{
	Name:        "logs",
	Aliases:     []string{"log"},
	Usage:       "Show container logs",
	Description: `Show container logs. If a service name is not specified, all logs are shown.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "stop a single service",
		},
		&cli.BoolFlag{
			Name:    "follow",
			Aliases: []string{"f"},
			Usage:   "follow log output",
		},
		&cli.BoolFlag{
			Name:    "timestamps",
			Aliases: []string{"t"},
			Usage:   "show timestamps",
		},
	},
	Action: logsAction,
}
View Source
var RemoveCommand = cli.Command{
	Name:    "remove",
	Aliases: []string{"rm", "delete"},
	Usage:   "Remove docker containers",
	Description: `Remove docker containers.
If environment name is not specified current branch name is used.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "remove a single service",
		},
	},
	Action: removeAction,
}
View Source
var RestartCommand = cli.Command{
	Name:    "restart",
	Aliases: []string{"r", "reboot"},
	Usage:   "Restart docker containers",
	Description: `Restart docker containers.
If environment name is not specified current branch name is used.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "restart a single service",
		},
	},
	Action: restartAction,
}
View Source
var StartCommand = cli.Command{
	Name:    "start",
	Aliases: []string{"s", "up"},
	Usage:   "Start docker containers",
	Description: `Start docker containers.
If project name is not specified, current branch name is used.
If project does not exist it will be created.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "start a single service",
		},
		&cli.BoolFlag{
			Name:    "recreate",
			Aliases: []string{"r"},
			Usage:   "recreate the containers",
		},
		&cli.BoolFlag{
			Name:    "update",
			Aliases: []string{"u"},
			Usage:   "update the images and recreate the containers",
		},
		&cli.BoolFlag{
			Name:    "no-hooks",
			Aliases: []string{"without-hooks"},
			Usage:   "do not run pre/post start hooks",
		},
	},
	Action: startAction,
}
View Source
var StopCommand = cli.Command{
	Name:    "stop",
	Aliases: []string{"ss", "down"},
	Usage:   "Stop docker containers",
	Description: `Stop docker containers.
If environment name is not specified current branch name is used.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "stop a single service",
		},
		&cli.BoolFlag{
			Name:    "no-hooks",
			Aliases: []string{"without-hooks"},
			Usage:   "do not run pre/post start hooks",
		},
	},
	Action: stopAction,
}
View Source
var TerminalCommand = cli.Command{
	Name:        "terminal",
	Aliases:     []string{"term", "shell", "ssh"},
	ArgsUsage:   "[COMMAND]",
	Usage:       "Run terminal",
	Description: `Run terminal in the project.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    "project",
			Aliases: []string{"p"},
			Usage:   "set a project name",
		},
		&cli.StringFlag{
			Name:    "service",
			Aliases: []string{"s"},
			Usage:   "start a single service",
		},
	},
	Action: terminalAction,
}
View Source
var VersionCommand = cli.Command{
	Name:        "version",
	Aliases:     []string{"v"},
	Usage:       "Show version",
	Description: `Shows docker-env version, build date and commit hash.`,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "short",
			Aliases: []string{"s"},
			Usage:   "only show the version string",
		},
		&cli.BoolFlag{
			Name:    "build-date",
			Aliases: []string{"b"},
			Usage:   "only show the build date",
		},
		&cli.BoolFlag{
			Name:    "commit-hash",
			Aliases: []string{"c"},
			Usage:   "only show the commit hash",
		},
	},
	Action: versionAction,
}

Functions

func ExitWithErrorOnArgs

func ExitWithErrorOnArgs(c *cli.Context)

Types

type App

type App struct {
	Config   *config.Config
	Project  *project.Project
	Registry *registry.DockerProjectRegistry
}

func NewApp

func NewApp(c *cli.Context) (*App, error)

func (*App) RunPostStartHooks

func (app *App) RunPostStartHooks() error

func (*App) RunPostStopHooks

func (app *App) RunPostStopHooks() error

func (*App) RunPreStartHooks

func (app *App) RunPreStartHooks() error

type VersionFlags

type VersionFlags map[string]func()

Jump to

Keyboard shortcuts

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