github.com/torfuzx/docker@v1.8.1/builder/support.go (about)

     1  package builder
     2  
     3  import (
     4  	"regexp"
     5  	"strings"
     6  )
     7  
     8  const acceptableRemoteMIME = `(?:application/(?:(?:x\-)?tar|octet\-stream|((?:x\-)?(?:gzip|bzip2?|xz)))|(?:text/plain))`
     9  
    10  var mimeRe = regexp.MustCompile(acceptableRemoteMIME)
    11  
    12  func selectAcceptableMIME(ct string) string {
    13  	return mimeRe.FindString(ct)
    14  }
    15  
    16  func handleJSONArgs(args []string, attributes map[string]bool) []string {
    17  	if len(args) == 0 {
    18  		return []string{}
    19  	}
    20  
    21  	if attributes != nil && attributes["json"] {
    22  		return args
    23  	}
    24  
    25  	// literal string command, not an exec array
    26  	return []string{strings.Join(args, " ")}
    27  }