Don't abort during AUR search error

This commit is contained in:
morganamilo 2018-04-03 06:49:41 +01:00
parent c8f6145a18
commit 5bcb51bf00
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E
2 changed files with 13 additions and 8 deletions

11
cmd.go
View File

@ -360,10 +360,7 @@ func handleRemove() (err error) {
// NumberMenu presents a CLI for selecting packages to install.
func numberMenu(pkgS []string, flags []string) (err error) {
aurQ, err := narrowSearch(pkgS, true)
if err != nil {
return fmt.Errorf("Error during AUR search: %s", err)
}
aurQ, aurErr := narrowSearch(pkgS, true)
numaq := len(aurQ)
repoQ, numpq, err := queryRepo(pkgS)
if err != nil {
@ -382,6 +379,12 @@ func numberMenu(pkgS []string, flags []string) (err error) {
aurQ.printSearch(numpq + 1)
}
if aurErr != nil {
fmt.Printf("Error during AUR search: %s\n", aurErr)
fmt.Println("Showing repo packages only")
}
fmt.Println(bold(green(arrow + " Packages to install (eg: 1 2 3, 1-3 or ^4)")))
fmt.Print(bold(green(arrow + " ")))

View File

@ -130,10 +130,7 @@ func narrowSearch(pkgS []string, sortS bool) (aurQuery, error) {
// SyncSearch presents a query to the local repos and to the AUR.
func syncSearch(pkgS []string) (err error) {
aq, err := narrowSearch(pkgS, true)
if err != nil {
return err
}
aq, aurErr := narrowSearch(pkgS, true)
pq, _, err := queryRepo(pkgS)
if err != nil {
return err
@ -147,6 +144,11 @@ func syncSearch(pkgS []string) (err error) {
aq.printSearch(1)
}
if aurErr != nil {
fmt.Printf("Error during AUR search: %s\n", aurErr)
fmt.Println("Showing Repo packags only")
}
return nil
}