parser

package
v12.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments struct {
	Op      string
	Options map[string]*Option
	Targets []string
}

Arguments Parses command line arguments in a way we can interact with programmatically but also in a way that can easily be passed to pacman later on.

func MakeArguments

func MakeArguments() *Arguments

func (*Arguments) AddArg

func (a *Arguments) AddArg(options ...string) error

func (*Arguments) AddTarget

func (a *Arguments) AddTarget(targets ...string)

func (*Arguments) ClearTargets

func (a *Arguments) ClearTargets()

func (*Arguments) Copy

func (a *Arguments) Copy() (cp *Arguments)

func (*Arguments) CopyGlobal

func (a *Arguments) CopyGlobal() *Arguments

func (*Arguments) CreateOrAppendOption

func (a *Arguments) CreateOrAppendOption(option string, values ...string)

func (*Arguments) DelArg

func (a *Arguments) DelArg(options ...string)

func (*Arguments) ExistsArg

func (a *Arguments) ExistsArg(options ...string) bool

Multiple args acts as an OR operator.

func (*Arguments) ExistsDouble

func (a *Arguments) ExistsDouble(options ...string) bool

Multiple args acts as an OR operator.

func (*Arguments) FormatArgs

func (a *Arguments) FormatArgs() (args []string)

func (*Arguments) FormatGlobals

func (a *Arguments) FormatGlobals() (args []string)

func (*Arguments) GetArg

func (a *Arguments) GetArg(options ...string) (arg string, double, exists bool)

func (*Arguments) GetArgs

func (a *Arguments) GetArgs(option string) (args []string)

func (*Arguments) NeedRoot

func (a *Arguments) NeedRoot(mode TargetMode) bool

func (*Arguments) Parse

func (a *Arguments) Parse() error

func (*Arguments) String

func (a *Arguments) String() string

type Option

type Option struct {
	Global bool
	Args   []string
}

func (*Option) Add

func (o *Option) Add(args ...string)

func (*Option) First

func (o *Option) First() string

func (*Option) Set

func (o *Option) Set(arg string)

func (*Option) String

func (o *Option) String() string

type RebuildMode added in v12.1.0

type RebuildMode string
const (
	RebuildModeNo   RebuildMode = "no"
	RebuildModeYes  RebuildMode = "yes"
	RebuildModeTree RebuildMode = "tree"
	RebuildModeAll  RebuildMode = "all"
)

type TargetMode

type TargetMode int
const (
	ModeAny TargetMode = iota
	ModeAUR
	ModeRepo
)

func (TargetMode) AtLeastAUR

func (mode TargetMode) AtLeastAUR() bool

func (TargetMode) AtLeastRepo

func (mode TargetMode) AtLeastRepo() bool

Jump to

Keyboard shortcuts

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