cmdv2

package
v0.0.0-...-6f7621a Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCommand

func RegisterCommand(command Command)

RegisterCommand adds a new Command type to the list of available commands in the CLI.

Types

type Command

type Command interface {
	// Command returns the cobra.Command type so that the CLI can be built.
	Command() *cobra.Command

	// Init implements the bubbletea.Model.Init() interface.
	Init() tea.Cmd

	// Type returns a unique type string identifying the command.
	Type() CommandType

	// Update implements the bubbletea.Model.Update() interface.
	Update(msg tea.Msg) (tea.Model, tea.Cmd)

	// View implements the bubbletea.Model.View() interface.
	View() string
}

Command is an interface that implements the bubbletea.Model interface, as well as returning a cobra.Command type, so that they can play well together.

func RegisteredCommands

func RegisteredCommands() []Command

RegisteredCommands returns all registered Command types in the CLI.

type CommandType

type CommandType string

CommandType is the unique ID for a Command.

const (
	CommandTypeCompletion CommandType = "completion"
	CommandTypeVersion    CommandType = "version"
)

type Completion

type Completion struct {
	// contains filtered or unexported fields
}

Completion is a CLI command that generates shell completion scripts for different types of environments.

func (Completion) Command

func (c Completion) Command() *cobra.Command

func (Completion) Init

func (c Completion) Init() tea.Cmd

func (Completion) Type

func (c Completion) Type() CommandType

func (Completion) Update

func (c Completion) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Completion) View

func (c Completion) View() string

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version is a CLI command that outputs the current version of the CLI.

func (Version) Command

func (v Version) Command() *cobra.Command

func (Version) Init

func (v Version) Init() tea.Cmd

func (Version) Type

func (v Version) Type() CommandType

func (Version) Update

func (v Version) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Version) View

func (v Version) View() string

Jump to

Keyboard shortcuts

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