q/src/cli/Main.go

22 lines
392 B
Go

package cli
// 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(nil)
}
switch args[0] {
case "build":
return Build(args[1:])
case "system":
return System(args[1:])
default:
return Help(args[1:])
}
}