cli

package
v0.0.0-...-187538d Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cli implements the command line interface.

Index

Constants

View Source
const (
	// OutputTerminal is the text output.
	OutputTerminal = "TERMINAL"
	// OutputJSON is the json output.
	OutputJSON = "JSON"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CliCommandRegister

type CliCommandRegister interface {
	// RegisterCommands registers the commands for the client.
	RegisterCommands(command *cobra.Command) error
	// AddFlags adds the flags for the client.
	AddFlags(flagSet *flag.FlagSet) error
}

CliCommandRegister is the interface for the command register.

type CliInfo

type CliInfo struct {
	Name  string
	Use   string
	Short string
	Long  string
}

CliInfo declares the cli information.

type CliInitializer

type CliInitializer interface {
	// GetCliInfo returns the infos of the commands.
	GetCliInfo() CliInfo
	// GetCommandRegisters returns the command registers.
	GetCommandRegisters(v *viper.Viper) ([]CliCommandRegister, error)
}

CliInitializer is the cli initializer.

type CliPrinter

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

CliPrinter is the cli printer.

func NewCliPrinter

func NewCliPrinter(output string) (*CliPrinter, error)

NewCliPrinter returns a new cli printer.

func (*CliPrinter) Error

func (cp *CliPrinter) Error(err error)

Error prints the output.

func (*CliPrinter) Print

func (cp *CliPrinter) Print(output map[string]any)

Print prints the output.

Jump to

Keyboard shortcuts

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