cli

package
v0.0.0-...-2b69279 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllOutputFormats = map[OutputFormat]struct{}{
		TextOutputFormat: struct{}{},
		JSONOutputFormat: struct{}{},
	}
)
View Source
var DefaultGlobalArguments = GlobalArguments{
	OutputFormat: DefaultOutputFormat,
}
View Source
var (
	ErrRegistryDoesNotExist = errors.New("Registry does not exist")
)

Functions

func CliContext

func CliContext() (context.Context, func())

func CompleteRegistryFlag

func CompleteRegistryFlag(cmd *cobra.Command, argv []string, toComplete string) (variants []string, directive cobra.ShellCompDirective)

func ErrorToExitCode

func ErrorToExitCode(err error) int

func NewPackageAddCommand

func NewPackageAddCommand(parent *PackageCommand) *cobra.Command

func NewPackageCommand

func NewPackageCommand(args *GlobalArguments) *cobra.Command

func NewPackageListCommand

func NewPackageListCommand(parent *PackageCommand) *cobra.Command

func NewPackageUploadCommand

func NewPackageUploadCommand(parent *PackageCommand) *cobra.Command

func NewRegistryAddCommand

func NewRegistryAddCommand(args *GlobalArguments) *cobra.Command

func NewRegistryCommand

func NewRegistryCommand(args *GlobalArguments) *cobra.Command

func NewRegistryDeleteCommand

func NewRegistryDeleteCommand(args *GlobalArguments) *cobra.Command

func NewRegistryInitCommand

func NewRegistryInitCommand(args *GlobalArguments) *cobra.Command

func NewRegistryListCommand

func NewRegistryListCommand(args *GlobalArguments) *cobra.Command

func NewRepoAddCommand

func NewRepoAddCommand(parent *RepoCommand) *cobra.Command

func NewRepoCommand

func NewRepoCommand(args *GlobalArguments) *cobra.Command

func NewRepoInitCommand

func NewRepoInitCommand(parent *RepoCommand) *cobra.Command

func NewRootCommand

func NewRootCommand() *cobra.Command

func Run

func Run(ctx context.Context, args []string, extras ...any) error

Types

type Encoder

type Encoder interface {
	Encode(any) error
}

type GlobalArguments

type GlobalArguments struct {
	Config       string
	OutputFormat OutputFormat
}

func (*GlobalArguments) LoadConfig

func (a *GlobalArguments) LoadConfig() (cfg shop.Config, err error)

func (*GlobalArguments) ResolveConfig

func (a *GlobalArguments) ResolveConfig() (err error)

func (*GlobalArguments) SaveConfig

func (a *GlobalArguments) SaveConfig(cfg shop.Config) (err error)

func (*GlobalArguments) Setup

func (a *GlobalArguments) Setup(cmd *cobra.Command)

type OutputFormat

type OutputFormat string
const (
	TextOutputFormat OutputFormat = "text"
	JSONOutputFormat OutputFormat = "json"

	DefaultOutputFormat = TextOutputFormat
)

func (OutputFormat) CreateEncoder

func (f OutputFormat) CreateEncoder(writer io.Writer) Encoder

func (OutputFormat) MarshalText

func (f OutputFormat) MarshalText() ([]byte, error)

func (*OutputFormat) UnmarshalText

func (f *OutputFormat) UnmarshalText(d []byte) (err error)

type PackageAddCommand

type PackageAddCommand struct {
	*PackageCommand

	Description string
	Repo        string
}

func (*PackageAddCommand) Run

func (c *PackageAddCommand) Run(ctx context.Context, name string) error

type PackageCommand

type PackageCommand struct {
	Arguments    *GlobalArguments
	RegistryName string
	Cfg          shop.Config
}

type PackageListCommand

type PackageListCommand struct {
	*PackageCommand
}

func (*PackageListCommand) Run

func (c *PackageListCommand) Run(ctx context.Context, prefix string) error

type PackageListOutputItem

type PackageListOutputItem struct {
	*shop.PackageOrPrefix
}

func (PackageListOutputItem) IntoText

func (i PackageListOutputItem) IntoText() (text []byte, err error)

type PackageUploadCommand

type PackageUploadCommand struct {
	*PackageCommand

	Tags TagsMap
	Refs RefSet
	Dir  string
}

func (*PackageUploadCommand) Run

func (c *PackageUploadCommand) Run(ctx context.Context, name, dir string) error

type RefSet

type RefSet map[string]struct{}

func (RefSet) Set

func (s RefSet) Set(v string) error

func (RefSet) String

func (s RefSet) String() string

func (RefSet) Type

func (s RefSet) Type() string

type RegistryAddCommand

type RegistryAddCommand struct {
	Arguments *GlobalArguments

	RegistryName string
	Admin        bool
	Write        bool

	EndpointUrl     string
	Region          string
	AWSProfile      string
	AccessKeyId     string
	SecretAccessKey string
}

func (*RegistryAddCommand) Run

func (c *RegistryAddCommand) Run(ctx context.Context, url string) error

type RegistryDeleteCommand

type RegistryDeleteCommand struct {
	Arguments *GlobalArguments
}

func (*RegistryDeleteCommand) Run

func (c *RegistryDeleteCommand) Run(ctx context.Context, name string) error

type RegistryInitCommand

type RegistryInitCommand struct {
	Arguments    *GlobalArguments
	Name         string
	ManifestName string
}

func (*RegistryInitCommand) Run

func (c *RegistryInitCommand) Run(ctx context.Context, url string) error

type RegistryListCommand

type RegistryListCommand struct {
	Arguments *GlobalArguments
}

func (*RegistryListCommand) Run

type RegistryListOutputItem

type RegistryListOutputItem struct {
	Name      string `json:"name"`
	URL       string `json:"url"`
	Admin     bool   `json:"admin"`
	Write     bool   `json:"write"`
	IsDefault bool   `json:"default"`
}

func RegistryListOutputItemFromRegistry

func RegistryListOutputItemFromRegistry(registry shop.RegistryConfig, name string, isDefault bool) RegistryListOutputItem

func (RegistryListOutputItem) IntoText

func (i RegistryListOutputItem) IntoText() (d []byte, err error)

type RepoAddCommand

type RepoAddCommand struct {
	*RepoCommand

	Registry string
	Name     string
	URL      string
}

func (*RepoAddCommand) Run

func (c *RepoAddCommand) Run(ctx context.Context, url string) error

type RepoCommand

type RepoCommand struct {
	Arguments *GlobalArguments
}

type RepoInitCommand

type RepoInitCommand struct {
	*RepoCommand
	Name        string
	ReadOnlyURL string
}

func (*RepoInitCommand) Run

func (c *RepoInitCommand) Run(ctx context.Context, u string) error

type TagsMap

type TagsMap map[string]string

func (TagsMap) Set

func (m TagsMap) Set(v string) error

func (TagsMap) String

func (m TagsMap) String() string

func (TagsMap) Type

func (m TagsMap) Type() string

type TextEncoder

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

func (TextEncoder) Encode

func (e TextEncoder) Encode(v any) error

type TextMarshaler

type TextMarshaler interface {
	IntoText() ([]byte, error)
}

type TextRepresentable

type TextRepresentable interface {
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

type TextVar

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

func (TextVar) Set

func (tv TextVar) Set(value string) error

func (TextVar) String

func (tv TextVar) String() string

func (TextVar) Type

func (tv TextVar) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳