|
@@ -1,28 +1,15 @@
|
|
package runconfig
|
|
package runconfig
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "github.com/docker/docker/api/types"
|
|
flag "github.com/docker/docker/pkg/mflag"
|
|
flag "github.com/docker/docker/pkg/mflag"
|
|
)
|
|
)
|
|
|
|
|
|
-// ExecConfig is a small subset of the Config struct that hold the configuration
|
|
|
|
-// for the exec feature of docker.
|
|
|
|
-type ExecConfig struct {
|
|
|
|
- User string // User that will run the command
|
|
|
|
- Privileged bool // Is the container in privileged mode
|
|
|
|
- Tty bool // Attach standard streams to a tty.
|
|
|
|
- Container string // Name of the container (to execute in)
|
|
|
|
- AttachStdin bool // Attach the standard input, makes possible user interaction
|
|
|
|
- AttachStderr bool // Attach the standard output
|
|
|
|
- AttachStdout bool // Attach the standard error
|
|
|
|
- Detach bool // Execute in detach mode
|
|
|
|
- Cmd []string // Execution commands and args
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// ParseExec parses the specified args for the specified command and generates
|
|
// ParseExec parses the specified args for the specified command and generates
|
|
// an ExecConfig from it.
|
|
// an ExecConfig from it.
|
|
// If the minimal number of specified args is not right or if specified args are
|
|
// If the minimal number of specified args is not right or if specified args are
|
|
// not valid, it will return an error.
|
|
// not valid, it will return an error.
|
|
-func ParseExec(cmd *flag.FlagSet, args []string) (*ExecConfig, error) {
|
|
|
|
|
|
+func ParseExec(cmd *flag.FlagSet, args []string) (*types.ExecConfig, error) {
|
|
var (
|
|
var (
|
|
flStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Keep STDIN open even if not attached")
|
|
flStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Keep STDIN open even if not attached")
|
|
flTty = cmd.Bool([]string{"t", "-tty"}, false, "Allocate a pseudo-TTY")
|
|
flTty = cmd.Bool([]string{"t", "-tty"}, false, "Allocate a pseudo-TTY")
|
|
@@ -40,7 +27,7 @@ func ParseExec(cmd *flag.FlagSet, args []string) (*ExecConfig, error) {
|
|
parsedArgs := cmd.Args()
|
|
parsedArgs := cmd.Args()
|
|
execCmd = parsedArgs[1:]
|
|
execCmd = parsedArgs[1:]
|
|
|
|
|
|
- execConfig := &ExecConfig{
|
|
|
|
|
|
+ execConfig := &types.ExecConfig{
|
|
User: *flUser,
|
|
User: *flUser,
|
|
Privileged: *flPrivileged,
|
|
Privileged: *flPrivileged,
|
|
Tty: *flTty,
|
|
Tty: *flTty,
|