q/src/cli/Main.go
2024-06-27 20:30:33 +02:00

26 lines
461 B
Go

package cli
import "os"
// Main is the entry point for the CLI frontend.
// It returns the exit code of the compiler.
// We never call os.Exit directly here because it's bad for testing.
func Main(args []string) int {
if len(args) == 0 {
return Help(os.Stderr, 2)
}
switch args[0] {
case "build":
return Build(args[1:])
case "system":
return System(args[1:])
case "help":
return Help(os.Stdout, 0)
default:
return Help(os.Stderr, 2)
}
}