mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
38 lines
778 B
Go
38 lines
778 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// PacmanBin describes the default installation point of pacman
|
|
const PacmanBin string = "/usr/bin/pacman"
|
|
|
|
// PacmanConf describes the default pacman config file
|
|
const PacmanConf string = "/etc/pacman.conf"
|
|
|
|
// SearchMode is search without numbers
|
|
const SearchMode int = -1
|
|
|
|
// BuildDir is the root for package building
|
|
const BuildDir string = "/tmp/yaytmp/"
|
|
|
|
func main() {
|
|
var err error
|
|
conf, err := readConfig(PacmanConf)
|
|
|
|
if os.Args[1] == "-Ss" {
|
|
err = searchMode(strings.Join(os.Args[2:], " "), conf)
|
|
|
|
} else if os.Args[1] == "-S" {
|
|
err = InstallPackage(os.Args[2], conf, os.Args[3:]...)
|
|
} else {
|
|
err = searchAndInstall(os.Args[1], conf, os.Args[3:]...)
|
|
}
|
|
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
}
|