cmd

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 35 Imported by: 20

Documentation

Overview

Package cmd implements console commands

Index

Constants

View Source
const (
	Yes = "yes"
	No  = "no"
)

Various command flags/UI things

Variables

This section is empty.

Functions

func CleanupContext added in v0.9.1

func CleanupContext()

CleanupContext does partial shutdown of context

func GetContext added in v1.2.0

func GetContext() *ctx.AptlyContext

GetContext gives access to the context

func GetStringOrFileContent added in v1.6.0

func GetStringOrFileContent(value string) (string, error)

func InitContext

func InitContext(flags *flag.FlagSet) error

InitContext initializes context with default settings

func ListPackagesRefList

func ListPackagesRefList(reflist *deb.PackageRefList, collectionFactory *deb.CollectionFactory) (err error)

ListPackagesRefList shows list of packages in PackageRefList

func LookupOption added in v0.9.1

func LookupOption(defaultValue bool, flags *flag.FlagSet, name string) (result bool)

LookupOption checks boolean flag with default (usually config) and command-line setting

func PrintPackageList added in v0.9.6

func PrintPackageList(result *deb.PackageList, format, prefix string) error

PrintPackageList shows package list with specified format or default representation

func RootCommand

func RootCommand() *commander.Command

RootCommand creates root command in command tree

func Run added in v0.9.1

func Run(cmd *commander.Command, cmdArgs []string, initContext bool) (returnCode int)

Run runs single command starting from root cmd with args, optionally initializing context

func ShutdownContext

func ShutdownContext()

ShutdownContext shuts context down

Types

type StringOrFileFlag added in v1.6.0

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

StringOrFileFlag is a custom flag type that can handle both string input and file input. If the input starts with '@', it is treated as a filename and the contents are read from the file. If the input is '@-', the contents are read from stdin.

func AddStringOrFileFlag added in v1.6.0

func AddStringOrFileFlag(flagSet *flag.FlagSet, name string, value string, usage string) *StringOrFileFlag

func (*StringOrFileFlag) Get added in v1.6.0

func (s *StringOrFileFlag) Get() any

func (*StringOrFileFlag) Set added in v1.6.0

func (s *StringOrFileFlag) Set(value string) error

func (*StringOrFileFlag) String added in v1.6.0

func (s *StringOrFileFlag) String() string

Jump to

Keyboard shortcuts

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