figkingpin

package module
v0.0.0-...-1ee14ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 4 Imported by: 0

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateFigCompletionSpec

func GenerateFigCompletionSpec(a *kingpin.Application) func(c *kingpin.ParseContext) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL