Bootstrap Go CLI shell

This commit is contained in:
2026-07-03 06:01:34 +00:00
parent 60682e977e
commit 0c68d3f727
4 changed files with 119 additions and 0 deletions

30
internal/cli/run.go Normal file
View File

@@ -0,0 +1,30 @@
package cli
import (
"fmt"
"io"
)
const usage = "Usage:\n notarius help\n"
// Run executes the command-line interface and returns a process exit code.
func Run(args []string, stdout, stderr io.Writer) int {
if len(args) == 0 {
writeUsage(stdout)
return 0
}
switch args[0] {
case "help", "--help", "-h":
writeUsage(stdout)
return 0
default:
fmt.Fprintf(stderr, "notarius: unknown command %q\n", args[0])
writeUsage(stderr)
return 2
}
}
func writeUsage(w io.Writer) {
fmt.Fprint(w, usage)
}