mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Fixed pass to Pacman
This commit is contained in:
parent
95b222c70c
commit
5b60bb6781
2 changed files with 19 additions and 6 deletions
23
pacman.go
23
pacman.go
|
@ -127,13 +127,26 @@ func (s *RepoSearch) PrintSearch(mode int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func passToPacman(op string, flags string) error {
|
func passToPacman(op string, pkg string, flags string) error {
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
if flags == "" {
|
var args []string
|
||||||
cmd = exec.Command("sudo", "pacman", op)
|
|
||||||
} else {
|
args = append(args, op)
|
||||||
cmd = exec.Command("sudo", "pacman", op, flags)
|
if pkg != "" {
|
||||||
|
args = append(args, pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flags != "" {
|
||||||
|
args = append(args, flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(op, "Q") {
|
||||||
|
cmd = exec.Command("pacman", args...)
|
||||||
|
} else {
|
||||||
|
args = append(args, "pacman")
|
||||||
|
cmd = exec.Command("sudo", args...)
|
||||||
|
}
|
||||||
|
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
2
yay.go
2
yay.go
|
@ -87,7 +87,7 @@ func main() {
|
||||||
case "yogurt":
|
case "yogurt":
|
||||||
err = searchAndInstall(pkg, &conf, flag)
|
err = searchAndInstall(pkg, &conf, flag)
|
||||||
default:
|
default:
|
||||||
fmt.Println("Pass to pacman")
|
err = passToPacman(op, pkg, flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue