Establish initial Go application skeleton

This commit is contained in:
2026-05-29 16:52:02 +00:00
parent 05b56d6ea6
commit e5cd23de48
9 changed files with 163 additions and 2 deletions

45
internal/cli/root.go Normal file
View File

@@ -0,0 +1,45 @@
package cli
import (
"context"
"flag"
"fmt"
"io"
)
const helpText = `weatherreporter prepares weather reports from normalized forecast data.
Usage:
weatherreporter --help
Options:
-h, --help Show this help message.
`
// Run parses the root command and executes the selected behavior.
func Run(ctx context.Context, args []string, stdout io.Writer, stderr io.Writer) error {
_ = ctx
_ = stderr
fs := flag.NewFlagSet("weatherreporter", flag.ContinueOnError)
fs.SetOutput(io.Discard)
help := fs.Bool("help", false, "show help")
fs.BoolVar(help, "h", false, "show help")
if err := fs.Parse(args); err != nil {
return err
}
if *help {
_, err := fmt.Fprint(stdout, helpText)
return err
}
if fs.NArg() > 0 {
return fmt.Errorf("unknown argument %q", fs.Arg(0))
}
_, err := fmt.Fprint(stdout, helpText)
return err
}