From 5b8de40b4c57bdd0fc5e2818a1ac5f2cf5c9c9a5 Mon Sep 17 00:00:00 2001 From: MDietermann Date: Mon, 13 Apr 2026 18:24:37 +0200 Subject: [PATCH] chore: bootstrap Go project with cobra skeleton --- .gitignore | 7 +++++++ cmd/archduino/main.go | 45 +++++++++++++++++++++++++++++++++++++++++++ go.mod | 9 +++++++++ go.sum | 10 ++++++++++ 4 files changed, 71 insertions(+) create mode 100644 cmd/archduino/main.go create mode 100644 go.mod create mode 100644 go.sum diff --git a/.gitignore b/.gitignore index bc0aec7..664b874 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ .idea WokwiKey.txt + +# Go +/archduino +/dist/ +*.test +*.out +coverage.* diff --git a/cmd/archduino/main.go b/cmd/archduino/main.go new file mode 100644 index 0000000..c378b65 --- /dev/null +++ b/cmd/archduino/main.go @@ -0,0 +1,45 @@ +package main + +import ( + "fmt" + "os" + + "github.com/spf13/cobra" +) + +var version = "dev" + +func main() { + root := &cobra.Command{ + Use: "archduino", + Short: "Archduino installer and toolbox", + SilenceUsage: true, + SilenceErrors: true, + Version: version, + } + + root.AddCommand(newInstallCmd()) + + if err := root.Execute(); err != nil { + fmt.Fprintln(os.Stderr, "error:", err) + os.Exit(1) + } +} + +func newInstallCmd() *cobra.Command { + var noTUI bool + var dryRun bool + cmd := &cobra.Command{ + Use: "install", + Short: "Install or reconcile the Archduino toolset", + RunE: func(cmd *cobra.Command, args []string) error { + // Foundation scaffold: real wiring lands in Task 11. + fmt.Println("archduino install (stub)") + fmt.Printf(" --no-tui=%v --dry-run=%v\n", noTUI, dryRun) + return nil + }, + } + cmd.Flags().BoolVar(&noTUI, "no-tui", false, "plain-text output, no interactive UI") + cmd.Flags().BoolVar(&dryRun, "dry-run", false, "show planned actions without applying") + return cmd +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2fae689 --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module github.com/MDietermann/ArduinoArchSetup + +go 1.26.2 + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/cobra v1.10.2 // indirect + github.com/spf13/pflag v1.0.9 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..a6ee3e0 --- /dev/null +++ b/go.sum @@ -0,0 +1,10 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=