From 91b7c94da7e27a1379f971093170b48dedd37c7b Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Thu, 2 Jan 2025 20:23:53 +0100 Subject: [PATCH] add simple main runnable --- src/cmd/main/main.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/cmd/main/main.go diff --git a/src/cmd/main/main.go b/src/cmd/main/main.go new file mode 100644 index 0000000..906fbc2 --- /dev/null +++ b/src/cmd/main/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "github.com/garciat/gobid/check" + "github.com/garciat/gobid/compile" + "io" + "os" +) + +func main() { + unit := compile.NewCompilationUnit("main") + for _, arg := range os.Args[1:] { + switch arg { + case "-v": + *check.DebugAll = true + case "-": + stdin, err := io.ReadAll(os.Stdin) + if err != nil { + panic(err) + } + unit.AddSource("stdin.go", stdin) + default: + unit.AddFile(arg) + } + } + unit.Compile() +}