mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-19 00:31:02 -04:00
3834c605e5
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
19 lines
541 B
Go
19 lines
541 B
Go
package instructions
|
|
|
|
import "strings"
|
|
|
|
// handleJSONArgs parses command passed to CMD, ENTRYPOINT, RUN and SHELL 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, " ")}
|
|
}
|