Remove ArgsAsString because its a util function

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-04-14 07:08:54 +00:00
parent 35a88f2c29
commit 9bd7d09871
2 changed files with 11 additions and 13 deletions

View File

@ -365,18 +365,6 @@ func populateCommand(c *Container, env []string) {
c.command.Env = env
}
func (container *Container) ArgsAsString() string {
var args []string
for _, arg := range container.Args {
if strings.Contains(arg, " ") {
args = append(args, fmt.Sprintf("'%s'", arg))
} else {
args = append(args, arg)
}
}
return strings.Join(args, " ")
}
func (container *Container) Start() (err error) {
container.Lock()
defer container.Unlock()

View File

@ -1063,7 +1063,17 @@ func (srv *Server) Containers(job *engine.Job) engine.Status {
out.SetList("Names", names[container.ID])
out.Set("Image", srv.runtime.Repositories().ImageName(container.Image))
if len(container.Args) > 0 {
out.Set("Command", fmt.Sprintf("\"%s %s\"", container.Path, container.ArgsAsString()))
args := []string{}
for _, arg := range container.Args {
if strings.Contains(arg, " ") {
args = append(args, fmt.Sprintf("'%s'", arg))
} else {
args = append(args, arg)
}
}
argsAsString := strings.Join(args, " ")
out.Set("Command", fmt.Sprintf("\"%s %s\"", container.Path, argsAsString))
} else {
out.Set("Command", fmt.Sprintf("\"%s\"", container.Path))
}