cmd

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package cmd provides subcommands for the vervet CLI.

Index

Constants

This section is empty.

Variables

View Source
var Vervet = NewApp(VervetParams{
	Stdin:  os.Stdin,
	Stdout: os.Stdout,
	Stderr: os.Stderr,
	Prompt: Prompt{},
})

Vervet is the vervet application with the CLI application.

Functions

func Compile

func Compile(ctx *cli.Context) error

Compile compiles versioned resources into versioned API specs.

func Lint

func Lint(ctx *cli.Context) error

Lint checks versioned resources against linting rules.

func Localize

func Localize(ctx *cli.Context) error

Localize references and validate a single OpenAPI spec file

func Resolve

func Resolve(ctx *cli.Context) error

Resolve aggregates, renders and validates resource specs at a particular version.

func ScaffoldInit

func ScaffoldInit(ctx *cli.Context) error

ScaffoldInit creates a new project configuration from a provided scaffold directory.

func VersionFiles

func VersionFiles(ctx *cli.Context) error

VersionFiles is a command that lists all versioned OpenAPI spec files of matching resources. It takes optional arguments to filter the output: api resource

func VersionList

func VersionList(ctx *cli.Context) error

VersionList is a command that lists all the versions of matching resources. It takes optional arguments to filter the output: api resource

func VersionNew

func VersionNew(ctx *cli.Context) error

VersionNew generates a new resource.

Types

type Prompt

type Prompt struct{}

Prompt is the default interactive prompt for vervet.

func (Prompt) Confirm

func (p Prompt) Confirm(label string) (bool, error)

Confirm implements VervetPrompt.Confirm

func (Prompt) Entry

func (p Prompt) Entry(label string) (string, error)

Entry implements VervetPrompt.Entry

func (Prompt) Select

func (p Prompt) Select(label string, items []string) (string, error)

Select implements VervetPrompt.Select

type VervetApp

type VervetApp struct {
	App    *cli.App
	Params VervetParams
}

VervetApp contains the cli Application.

func NewApp

func NewApp(vp VervetParams) *VervetApp

NewApp returns a new VervetApp with the provided params.

func (*VervetApp) Run

func (v *VervetApp) Run(args []string) error

Run runs the cli.App with the Vervet config params.

type VervetParams

type VervetParams struct {
	Stdin  io.ReadCloser
	Stdout io.WriteCloser
	Stderr io.WriteCloser
	Prompt VervetPrompt
}

VervetParams contains configuration parameters for the Vervet CLI application.

type VervetPrompt

type VervetPrompt interface {
	Confirm(label string) (bool, error)                  // Confirm y/n an action
	Entry(label string) (string, error)                  // Gather a freeform entry in response to a question
	Select(label string, items []string) (string, error) // Select from a limited number of entries
}

VervetPrompt defines the interface for interactive prompts in vervet.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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