Skip to content

withfig/fig_kingpin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fig Kingpin

Support for generating Fig Spec from Kingpin CLI apps

Usage

1. Add the figkingpin package and --completion-spec-fig to your app

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()
)

2. Generate a Fig Spec via --completion-spec-fig

go run main.go --completion-spec-fig > fig-spec.ts

About

Generate Fig Spec from Go Kingpin

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages