Support for generating Fig Spec from Kingpin CLI apps
import (
"github.com/alecthomas/kingpin/v2"
// 1. Add the figkingpin package
figkingpin "github.com/withfig/fig_kingpin"
)
var (
app = kingpin.New("App", "A demo app")
// 2. Add a top level flag to gen fig spec, it is hidden from the help output
completionSpecFig = app.Flag("completion-spec-fig", "Generate completion script for fig.").Hidden().PreAction(figkingpin.GenerateFigCompletionSpec(app)).Bool()
)
go run main.go --completion-spec-fig > fig-spec.ts