Exemple #1
0
// CmdVersion show the Get3W version information.
//
// Usage: get3w version
func (cli *Get3WCli) CmdVersion(args ...string) error {
	cmd := Cli.Subcmd("version", nil, Cli.Get3WCommands["version"].Description, true)
	cmd.Require(flag.Exact, 0)
	cmd.ParseFlags(args, true)

	return cli.version()
}
Exemple #2
0
// CmdLogout logs a user out from a Docker registry.
//
// If no server is specified, the user will be logged out from the registry's index server.
//
// Usage: get3w logout [SERVER]
func (cli *Get3WCli) CmdLogout(args ...string) error {
	cmd := Cli.Subcmd("logout", []string{"[SERVER]"}, Cli.Get3WCommands["logout"].Description+".\nIf no server is specified is the default.", true)
	cmd.Require(flag.Max, 1)

	cmd.ParseFlags(args, true)

	return cli.logout()
}
Exemple #3
0
// CmdRun builds a new image from the source code at a given path.
//
// If '-' is provided instead of a path or URL, Docker will build an image from either a Dockerfile or tar archive read from STDIN.
//
// Usage: get3w run [OPTIONS] PATH | URL | -
func (cli *Get3WCli) CmdRun(args ...string) error {
	cmd := Cli.Subcmd("run", []string{"", "DIR"}, Cli.Get3WCommands["run"].Description, true)
	cmd.Require(flag.Max, 1)
	cmd.ParseFlags(args, true)

	dir := cmd.Arg(0)

	return cli.run(dir)
}
Exemple #4
0
// CmdGet get an app repository from the remote address.
//
// Usage: get3w get [OPTIONS] REMOTEURL DIR
func (cli *Get3WCli) CmdGet(args ...string) error {
	cmd := Cli.Subcmd("get", []string{"URL", "URL DIR"}, Cli.Get3WCommands["get"].Description, true)
	cmd.Require(flag.Min, 1)
	cmd.ParseFlags(args, true)

	url := cmd.Arg(0)
	dir := cmd.Arg(1)

	return cli.get(url, dir)
}
Exemple #5
0
// CmdLogin logs in or registers a user to a Docker registry service.
//
// If no server is specified, the user will be logged into or registered to the registry's index server.
//
// Usage: get3w login SERVER
func (cli *Get3WCli) CmdLogin(args ...string) error {
	cmd := Cli.Subcmd("login", []string{"[SERVER]"}, Cli.Get3WCommands["login"].Description+".\nIf no server is specified is the default.", true)
	cmd.Require(flag.Max, 1)

	var username, password string

	cmd.StringVar(&username, []string{"u", "-username"}, "", "Username")
	cmd.StringVar(&password, []string{"p", "-password"}, "", "Password")

	cmd.ParseFlags(args, true)

	_, err := cli.login(username, password)
	return err
}