feat: scaffold dirs with a noop miro init command
This commit is contained in:
+3
-1
@@ -1 +1,3 @@
|
||||
/verti/
|
||||
/verti/
|
||||
/AGENTS.md
|
||||
/build/
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
.PHONY: build test
|
||||
|
||||
BIN := build/miro
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
go build -o $(BIN) ./cmd/miro
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
+23
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"miro/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Exit(cmd.Run(os.Args[1:]))
|
||||
}
|
||||
+19
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package miro
|
||||
|
||||
// Init is the current no-op initializer placeholder.
|
||||
func Init() error {
|
||||
return nil
|
||||
}
|
||||
@@ -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...)))
|
||||
}
|
||||
Reference in New Issue
Block a user