pkgm

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package pkgm manages package installations and removals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(list []string, match string) bool

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

func ParseArguments(arguments []string) (packages, flags []string)

ParseArguments splits packages from flags in string arrays. Useful for parsing the packages & flags from Cobra.

func RemoveDuplicates

func RemoveDuplicates(appendList *[]string, baseList *[]string) []string

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

func NewOperation(opType string, packages []string, flags []string, autoInstall bool) Operation

NewOperation creates a new operation struct that is used to request a transaction. Accepted types: ("add", "del", "update", "upgrade", "search", "clean").

func Read

func Read(data []byte) (Operation, error)

Read parses a bytes list and returns aan operation and an error.

func (*Operation) Process added in v0.2.0

func (e *Operation) Process(cfg *config.Structure) error

Process processes the transaction and updates the config reference. Returns an error in case of failure.

func (*Operation) ProcessCmd added in v0.2.0

func (e *Operation) ProcessCmd(cfg *config.Structure, attach podman.Attach) (*exec.Cmd, error)

ProcessCmd processes the transaction and returns a command. Config updates have to be handle separately.

func (*Operation) String added in v0.2.0

func (e *Operation) String() string

String returns a string representation of the operation

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) ToJSON added in v0.2.0

func (e *Operation) ToJSON() string

ToJSON converts the operation to a JSON string

func (*Operation) UpdateConfig added in v0.2.0

func (e *Operation) UpdateConfig(cfg *config.Structure)

UpdateConfig updates the config file with the new packages

func (*Operation) Write added in v0.2.0

func (e *Operation) Write(path string, perm os.FileMode) error

Write writes a JSON formatted data into a file. In this case, it's used to write into the pipe or socket.

Jump to

Keyboard shortcuts

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