flatface.go: menus no longer crash on flatpak error
This commit is contained in:
parent
fbc04729e8
commit
0ccdfeaa40
12
flatface.go
12
flatface.go
@ -37,7 +37,7 @@ func searchRepo() {
|
|||||||
cmd := exec.Command("flatpak", "search", programName)
|
cmd := exec.Command("flatpak", "search", programName)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("cmd.Run() failed with %s\n", err)
|
searchRepo()
|
||||||
}
|
}
|
||||||
fmt.Print("\n", "Results for ", programName, ": \n\n", string(out), "\n")
|
fmt.Print("\n", "Results for ", programName, ": \n\n", string(out), "\n")
|
||||||
searchRepo()
|
searchRepo()
|
||||||
@ -57,11 +57,17 @@ func installPak() {
|
|||||||
return
|
return
|
||||||
} else if programName == "q" {
|
} else if programName == "q" {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
} else if programName == "" {
|
||||||
|
print("Please enter valid input\n")
|
||||||
|
installPak()
|
||||||
|
} else if programName == " " {
|
||||||
|
print("Please enter valid input")
|
||||||
|
installPak()
|
||||||
} else {
|
} else {
|
||||||
cmd := exec.Command("flatpak", "install", "-y", "flathub", programName)
|
cmd := exec.Command("flatpak", "install", "-y", "flathub", programName)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("cmd.Run() failed with %s\n", err)
|
installPak()
|
||||||
}
|
}
|
||||||
fmt.Print(string(out), "\n")
|
fmt.Print(string(out), "\n")
|
||||||
installPak()
|
installPak()
|
||||||
@ -94,7 +100,7 @@ func removePak() {
|
|||||||
cmd := exec.Command("flatpak", "uninstall", programName)
|
cmd := exec.Command("flatpak", "uninstall", programName)
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("cmd.Run() failed with %s\n", err)
|
removePak()
|
||||||
}
|
}
|
||||||
fmt.Print(string(out), "\n\n")
|
fmt.Print(string(out), "\n\n")
|
||||||
removePak()
|
removePak()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user