Documentation
¶
Overview ¶
Package pkgm manages package installations and removals.
Index ¶
- func ContainsString(list []string, match string) bool
- func ParseArguments(arguments []string) (packages, flags []string)
- func RemoveDuplicates(appendList *[]string, baseList *[]string) []string
- type Operation
- func (e *Operation) Process(cfg *config.Structure) error
- func (e *Operation) ProcessCmd(cfg *config.Structure, attach podman.Attach) (*exec.Cmd, error)
- func (e *Operation) String() string
- func (e *Operation) StringCommand(cfg *config.PackageManager) (string, error)
- func (e *Operation) ToJSON() string
- func (e *Operation) UpdateConfig(cfg *config.Structure)
- func (e *Operation) Write(path string, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsString ¶
ContainsString loops through the list and returns true if an item matches the string. Returns true if the item matched our string. False if not.
func ParseArguments ¶
ParseArguments splits packages from flags in string arrays. Useful for parsing the packages & flags from Cobra.
func RemoveDuplicates ¶
RemoveDuplicates returns a new array based on `baseList` without anything repeated on the append list.
Types ¶
type Operation ¶ added in v0.2.0
type Operation struct { Type string `json:"operation"` Packages []string `json:"packages"` Flags []string `json:"flags"` AutoInstall bool `json:"auto-install"` DevInstall bool `json:"dev-install"` UserOperation bool `json:"run-as-user"` }
Operation is a struct that is used to install/delete packages.
func NewOperation ¶
NewOperation creates a new operation struct that is used to request a transaction. Accepted types: ("add", "del", "update", "upgrade", "search", "clean").
func (*Operation) Process ¶ added in v0.2.0
Process processes the transaction and updates the config reference. Returns an error in case of failure.
func (*Operation) ProcessCmd ¶ added in v0.2.0
ProcessCmd processes the transaction and returns a command. Config updates have to be handle separately.
func (*Operation) StringCommand ¶ added in v0.2.0
func (e *Operation) StringCommand(cfg *config.PackageManager) (string, error)
StringCommand returns the string that will be send to the container. For example: "apt install -y vim".
func (*Operation) UpdateConfig ¶ added in v0.2.0
UpdateConfig updates the config file with the new packages