yay.go 781 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "strings"
  6. )
  7. // PacmanBin describes the default installation point of pacman
  8. const PacmanBin string = "/usr/bin/pacman"
  9. // PacmanConf describes the default pacman config file
  10. const PacmanConf string = "/etc/pacman.conf"
  11. // SearchMode is search without numbers
  12. const SearchMode bool = true
  13. // BuildDir is the root for package building
  14. const BuildDir string = "/tmp/yaytmp/"
  15. func main() {
  16. var err error
  17. conf, err := readConfig(PacmanConf)
  18. if os.Args[1] == "-Ss" {
  19. err = searchMode(strings.Join(os.Args[2:], " "), conf)
  20. } else if os.Args[1] == "-S" {
  21. err = InstallPackage(os.Args[2], conf, os.Args[3:]...)
  22. } else {
  23. err = searchAndInstall(os.Args[1], conf, os.Args[3:]...)
  24. }
  25. if err != nil {
  26. fmt.Println(err)
  27. os.Exit(1)
  28. }
  29. }