Files
docker-cli/components/engine/builder/dockerfile/support.go
Tomasz Kopczynski 870f41bf45 Unit tests for builder/dockerfile/support
Signed-off-by: Tomasz Kopczynski <tomek@kopczynski.net.pl>
Upstream-commit: d0ebc58b9c82d2baf0c672b514ba9733ff79a3a1
Component: engine
2016-04-16 00:19:58 +02:00

20 lines
531 B
Go

package dockerfile
import "strings"
// handleJSONArgs parses command passed to CMD, ENTRYPOINT or RUN instruction in Dockerfile
// for exec form it returns untouched args slice
// for shell form it returns concatenated args as the first element of a slice
func handleJSONArgs(args []string, attributes map[string]bool) []string {
if len(args) == 0 {
return []string{}
}
if attributes != nil && attributes["json"] {
return args
}
// literal string command, not an exec array
return []string{strings.Join(args, " ")}
}