BEN GREWELL
01PROJECT // SHIPPED

Stencil

A Go library for building polished command-line apps — typed flags, command trees and a console UI with leveled output and live spinner tasks.

Stencil removes the boilerplate from Go CLIs while giving them a consistent, refined terminal presence.

gomain.go
persistent := stencil.NewFlagSet()
cfg := persistent.String("config", "c", "path to config file", "app.yaml")
cfg.Env = "APP_CONFIG"

flags := stencil.NewFlagSet()
flags.Int("workers", "w", "worker count", 1).ConfigKey = "server.workers"

app := stencil.NewApp(
    stencil.WithName("app"),
    stencil.WithRootCommand(&stencil.Command{
        Name: "app", PersistentFlags: persistent,
        Sub: []*stencil.Command{{Name: "run", Flags: flags, Run: run}},
    }),
    stencil.WithConfigFile("config", stencil.YAMLLoader),
)
Status
shipped
Year
2025
Role
Author
Stack
Go · CLI
← All projects