diff --git a/.gitignore b/.gitignore index e57a8f5..68dede1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/verti/ \ No newline at end of file +/verti/ +/AGENTS.md +/build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..22fba82 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +.PHONY: build test + +BIN := build/miro + +build: + mkdir -p build + go build -o $(BIN) ./cmd/miro + +test: + go test ./... diff --git a/README.md b/README.md index e69de29..0dc15e2 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +a lean cli e2e testing framework written in go diff --git a/cmd/init.go b/cmd/init.go new file mode 100644 index 0000000..d605561 --- /dev/null +++ b/cmd/init.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "strings" + + "miro/internal/miro" + "miro/internal/output" +) + +func runInit(args []string) int { + if len(args) != 0 { + output.Printf("unknown init option: %s\n", strings.Join(args, " ")) + return 1 + } + + if err := miro.Init(); err != nil { + output.Printf("%v\n", err) + return 1 + } + + output.Println("Done initialising...") + return 0 +} diff --git a/cmd/miro/main.go b/cmd/miro/main.go new file mode 100644 index 0000000..60e8e42 --- /dev/null +++ b/cmd/miro/main.go @@ -0,0 +1,11 @@ +package main + +import ( + "os" + + "miro/cmd" +) + +func main() { + os.Exit(cmd.Run(os.Args[1:])) +} diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..bbddbae --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,19 @@ +package cmd + +import "miro/internal/output" + +// Run parses top-level CLI args and returns a process exit code. +func Run(args []string) int { + if len(args) == 0 { + output.Println("unknown command") + return 1 + } + + switch args[0] { + case "init": + return runInit(args[1:]) + default: + output.Printf("unknown command: %s\n", args[0]) + return 1 + } +} diff --git a/internal/miro/init.go b/internal/miro/init.go new file mode 100644 index 0000000..c2a7fcc --- /dev/null +++ b/internal/miro/init.go @@ -0,0 +1,6 @@ +package miro + +// Init is the current no-op initializer placeholder. +func Init() error { + return nil +} diff --git a/internal/output/output.go b/internal/output/output.go new file mode 100644 index 0000000..a00bf33 --- /dev/null +++ b/internal/output/output.go @@ -0,0 +1,33 @@ +package output + +import ( + "fmt" + "strings" +) + +const ( + bold = "\x1b[1m" + italic = "\x1b[3m" + wordmark = "\x1b[38;2;112;224;0m" + chevron = "\x1b[38;2;29;211;176m" + reset = "\x1b[0m" + prefix = wordmark + bold + italic + "miro" + reset + " " + chevron + bold + italic + "›" + reset + " " +) + +func Prefix() string { + return prefix +} + +func Format(msg string) string { + body := strings.TrimRight(msg, "\n") + suffix := msg[len(body):] + return Prefix() + body + suffix +} + +func Println(msg string) { + fmt.Println(Format(msg)) +} + +func Printf(format string, args ...any) { + fmt.Print(Format(fmt.Sprintf(format, args...))) +}