packer

package module
v0.0.0-...-e2f3b21 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 8 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

packer

Go Report Card GitHub go.mod Go version

Packer is a simple system package management tool for Go. Packer, helps you detect the system package manager and automate install your package or dependencies inside Go.

icon
Operation Systems Package Managers
Ubuntu apk
Debian apt
MXLinux brew
Mint dnf
Kali flatpak
ParrotOS snap
OpenSUSE pacman
CentOS paru
Oracle yay
Arch zypper
Manjaro
Alpine
Fedora
RHEL
MacOS

Download

You can simply run go get github.com/makifdb/packer to start using in your own code.

Examples

  1. Check package installation
func main() {
	p:= packer.Check("curl")
	fmt.Println(p)
}
// output: true
  1. Install package
func main() {
	packer.Install("curl")
}
  1. Remove package
func main() {
	packer.Remove("curl")
}
  1. Update system
func main() {	
	packer.Update()
}
  1. Detect Package Manager
func main() {	
	mngr, _ := DetectManager()
	fmt.Println(mngr.Name)
}
// output: yay

  1. Run a Custom Command
func main() {	
	packer.Command("uname -a")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(packageName string) bool

func Command

func Command(command string) error

func Install

func Install(packageName string) error

func Remove

func Remove(packageName string) error

func Update

func Update() error

Types

type Manager

type Manager struct {
	Name       string
	InstallArg string
	UpdateArg  string
	RemoveArg  string
}

func DetectManager

func DetectManager() (Manager, error)

Jump to

Keyboard shortcuts

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