get.porter.sh/porter@v1.3.0/cmd/testmixin/main.go (about) 1 package main 2 3 import ( 4 _ "embed" 5 "fmt" 6 "os" 7 ) 8 9 //go:embed schema.json 10 var schema string 11 12 //go:embed version.txt 13 var version string 14 15 func main() { 16 if len(os.Args) < 2 { 17 return 18 } 19 20 command := os.Args[1] 21 switch command { 22 case "version": 23 fmt.Println(version) 24 case "schema": 25 // This is a mixin that helps us test out our schema command 26 fmt.Println(schema) 27 case "lint": 28 // The test mixin does not implement lint 29 fmt.Fprintln(os.Stderr, `unknown command "lint" for "testmixin"`) 30 os.Exit(1) 31 case "build": 32 fmt.Println("# testmixin") 33 case "run": 34 fmt.Println("running testmixin...") 35 default: 36 fmt.Println("unsupported command:", command) 37 os.Exit(1) 38 } 39 }