github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/util/cmd/cmdline.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/buildkite/shellwords"
     5  	"os"
     6  )
     7  
     8  func StrCmdline(s string) []string {
     9  	if s == "" {
    10  		return []string{}
    11  	}
    12  
    13  	out, _ := shellwords.Split(s)
    14  	return out
    15  }
    16  
    17  func EnvCmdline(envvar string) []string {
    18  	return StrCmdline(os.Getenv(envvar))
    19  }