コード例 #1
0
ファイル: client.go プロジェクト: uniite/deis
func (c *Client) Dock(argv []string) error {
	usage := `Connect to the named docker container and run commands on it.

This is equivalent to running 'docker exec -it <target> <command>'.

Usage:
  deisctl dock <target> [<command>...]
`
	// parse command-line arguments
	args, err := docopt.Parse(usage, argv, true, "", true)
	if err != nil {
		return err
	}

	target := args["<target>"].(string)
	// handle help explicitly since docopt parsing is relaxed
	if target == "--help" {
		fmt.Println(usage)
		os.Exit(0)
	}

	var vargs []string
	if v, ok := args["<command>"]; ok {
		vargs = v.([]string)
	}

	return cmd.Dock(target, vargs, c.Backend)
}
コード例 #2
0
ファイル: client.go プロジェクト: sdgdsffdsfff/deis
func (c *Client) Dock(argv []string) error {
	usage := `Connect to the named docker container and run commands on it.

This is equivalent to running 'docker exec -it <target> <command>'.

Usage:
  deisctl dock <target> [<command>...]
`
	// parse command-line arguments
	args, err := docopt.Parse(usage, argv, true, "", true)
	if err != nil {
		return err
	}

	var vargs []string
	if v, ok := args["<command>"]; ok {
		vargs = v.([]string)
	}

	return cmd.Dock(args["<target>"].(string), vargs, c.Backend)
}