cmd

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 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 added in v1.1.0

type Prompt struct{}

Prompt is the default interactive prompt for vervet.

func (Prompt) Confirm added in v1.1.0

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

Confirm implements VervetPrompt.Confirm

func (Prompt) Entry added in v1.2.0

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

Entry implements VervetPrompt.Entry

func (Prompt) Select added in v1.2.0

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

Select implements VervetPrompt.Select

type VervetApp added in v1.1.0

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

VervetApp contains the cli Application.

func NewApp added in v1.1.0

func NewApp(vp VervetParams) *VervetApp

NewApp returns a new VervetApp with the provided params.

func (*VervetApp) Run added in v1.1.0

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

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

type VervetParams added in v1.1.0

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 added in v1.1.0

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