1
0
mirror of https://github.com/Jguer/yay synced 2024-07-08 04:16:16 +00:00

fix(search): in case there are no results, don't display number menu

This commit is contained in:
jguer 2021-11-03 00:03:35 +01:00
parent 02d33f63c0
commit f88bf5c212
No known key found for this signature in database
GPG Key ID: 6D6CC9BEA8556B35
3 changed files with 138 additions and 155 deletions

5
cmd.go
View File

@ -362,6 +362,11 @@ func displayNumberMenu(ctx context.Context, pkgS []string, dbExecutor db.Executo
return err return err
} }
if queryBuilder.Len() == 0 {
// no results were found
return nil
}
text.Infoln(gotext.Get("Packages to install (eg: 1 2 3, 1-3 or ^4)")) text.Infoln(gotext.Get("Packages to install (eg: 1 2 3, 1-3 or ^4)"))
numberBuf, err := text.GetInput("", false) numberBuf, err := text.GetInput("", false)

View File

@ -91,6 +91,10 @@ func (s *SourceQueryBuilder) Results(dbExecutor db.Executor, verboseSearch Searc
return nil return nil
} }
func (s *SourceQueryBuilder) Len() int {
return len(s.repoQuery) + len(s.aurQuery)
}
func (s *SourceQueryBuilder) GetTargets(include, exclude intrange.IntRanges, func (s *SourceQueryBuilder) GetTargets(include, exclude intrange.IntRanges,
otherExclude stringset.StringSet) ([]string, error) { otherExclude stringset.StringSet) ([]string, error) {
isInclude := len(exclude) == 0 && len(otherExclude) == 0 isInclude := len(exclude) == 0 && len(otherExclude) == 0

284
po/en.po
View File

@ -7,11 +7,11 @@ msgstr ""
"Language: \n" "Language: \n"
"X-Generator: xgotext\n" "X-Generator: xgotext\n"
#: install.go:612 #: pkg/menus/menu.go:32
msgid " (Build Files Exist)" msgid " (Build Files Exist)"
msgstr "" msgstr ""
#: install.go:608 #: pkg/menus/menu.go:28
msgid " (Installed)" msgid " (Installed)"
msgstr "" msgstr ""
@ -23,43 +23,37 @@ msgstr ""
msgid " (Wanted by: " msgid " (Wanted by: "
msgstr "" msgstr ""
#: pkg/db/ialpm/alpm.go:204 #: cmd.go:424
msgid " Input too long"
msgstr ""
#: cmd.go:503
msgid " [Installed]" msgid " [Installed]"
msgstr "" msgstr ""
#: cmd.go:462 #: cmd.go:383
#: install.go:166 #: install.go:158
#: install.go:204 #: install.go:192
msgid " there is nothing to do" msgid " there is nothing to do"
msgstr "" msgstr ""
#: install.go:632 #: pkg/menus/menu.go:48
#: install.go:711
#: install.go:719
msgid "%s [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)" msgid "%s [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)"
msgstr "" msgstr ""
#: install.go:1018 #: install.go:729
msgid "%s already made -- skipping build" msgid "%s already made -- skipping build"
msgstr "" msgstr ""
#: config.go:66 #: pkg/menus/edit_menu.go:57
msgid "%s is not set" msgid "%s is not set"
msgstr "" msgstr ""
#: pkg/settings/exe/cmd_builder.go:128 #: pkg/settings/exe/cmd_builder.go:198
msgid "%s is present." msgid "%s is present."
msgstr "" msgstr ""
#: install.go:1004 #: install.go:715
msgid "%s is up to date -- skipping" msgid "%s is up to date -- skipping"
msgstr "" msgstr ""
#: install.go:929 #: install.go:640
msgid "%s not satisfied, flushing install queue" msgid "%s not satisfied, flushing install queue"
msgstr "" msgstr ""
@ -67,7 +61,7 @@ msgstr ""
msgid "%s, required by: %s" msgid "%s, required by: %s"
msgstr "" msgstr ""
#: diff.go:43 #: pkg/menus/diff_menu.go:50
msgid "%s: No changes -- skipping" msgid "%s: No changes -- skipping"
msgstr "" msgstr ""
@ -83,7 +77,7 @@ msgstr ""
msgid "%s: ignoring package upgrade (%s => %s)" msgid "%s: ignoring package upgrade (%s => %s)"
msgstr "" msgstr ""
#: upgrade.go:137 #: upgrade.go:138
msgid "%s: local (%s) is newer than AUR (%s)" msgid "%s: local (%s) is newer than AUR (%s)"
msgstr "" msgstr ""
@ -96,45 +90,45 @@ msgstr ""
msgid "(%d/%d) Downloaded PKGBUILD: %s" msgid "(%d/%d) Downloaded PKGBUILD: %s"
msgstr "" msgstr ""
#: install.go:824 #: install.go:517
msgid "(%d/%d) Parsing SRCINFO: %s" msgid "(%d/%d) Parsing SRCINFO: %s"
msgstr "" msgstr ""
#: print.go:57 #: pkg/query/types.go:129
#: print.go:99 #: pkg/query/types.go:171
msgid "(Installed)" msgid "(Installed)"
msgstr "" msgstr ""
#: print.go:55 #: pkg/query/types.go:127
#: print.go:97 #: pkg/query/types.go:169
msgid "(Installed: %s)" msgid "(Installed: %s)"
msgstr "" msgstr ""
#: print.go:46 #: pkg/query/types.go:118
msgid "(Orphaned)" msgid "(Orphaned)"
msgstr "" msgstr ""
#: print.go:50 #: pkg/query/types.go:122
msgid "(Out-of-date: %s)" msgid "(Out-of-date: %s)"
msgstr "" msgstr ""
#: print.go:118 #: print.go:28
msgid "AUR URL" msgid "AUR URL"
msgstr "" msgstr ""
#: config.go:67 #: pkg/menus/edit_menu.go:58
msgid "Add %s or %s to your environment variables" msgid "Add %s or %s to your environment variables"
msgstr "" msgstr ""
#: main.go:99 #: main.go:102
msgid "Avoid running yay as root/sudo." msgid "Avoid running yay as root/sudo."
msgstr "" msgstr ""
#: print.go:124 #: print.go:34
msgid "Check Deps" msgid "Check Deps"
msgstr "" msgstr ""
#: upgrade.go:87 #: upgrade.go:88
msgid "Checking development packages..." msgid "Checking development packages..."
msgstr "" msgstr ""
@ -146,7 +140,7 @@ msgstr ""
msgid "Checking for inner conflicts..." msgid "Checking for inner conflicts..."
msgstr "" msgstr ""
#: clean.go:207 #: clean.go:206
msgid "Cleaning (%d/%d): %s" msgid "Cleaning (%d/%d): %s"
msgstr "" msgstr ""
@ -154,7 +148,7 @@ msgstr ""
msgid "Conflicting packages will have to be confirmed manually" msgid "Conflicting packages will have to be confirmed manually"
msgstr "" msgstr ""
#: print.go:126 #: print.go:36
msgid "Conflicts With" msgid "Conflicts With"
msgstr "" msgstr ""
@ -162,47 +156,47 @@ msgstr ""
msgid "Could not find all required packages:" msgid "Could not find all required packages:"
msgstr "" msgstr ""
#: clean.go:227 #: pkg/menus/clean_menu.go:52
msgid "Deleting (%d/%d): %s" msgid "Deleting (%d/%d): %s"
msgstr "" msgstr ""
#: print.go:122 #: print.go:32
msgid "Depends On" msgid "Depends On"
msgstr "" msgstr ""
#: print.go:116 #: print.go:26
msgid "Description" msgid "Description"
msgstr "" msgstr ""
#: install.go:710 #: pkg/menus/diff_menu.go:157
msgid "Diffs to show?" msgid "Diffs to show?"
msgstr "" msgstr ""
#: clean.go:73 #: clean.go:72
msgid "Do you want to remove ALL AUR packages from cache?" msgid "Do you want to remove ALL AUR packages from cache?"
msgstr "" msgstr ""
#: clean.go:90 #: clean.go:89
msgid "Do you want to remove ALL untracked AUR files?" msgid "Do you want to remove ALL untracked AUR files?"
msgstr "" msgstr ""
#: clean.go:75 #: clean.go:74
msgid "Do you want to remove all other AUR packages from cache?" msgid "Do you want to remove all other AUR packages from cache?"
msgstr "" msgstr ""
#: config.go:70 #: pkg/menus/edit_menu.go:61
msgid "Edit PKGBUILD with?" msgid "Edit PKGBUILD with?"
msgstr "" msgstr ""
#: cmd.go:404 #: pkg/query/errors.go:13
msgid "Error during AUR search: %s\n" msgid "Error during AUR search: %s\n"
msgstr "" msgstr ""
#: print.go:175 #: print.go:85
msgid "Explicitly installed packages: %s" msgid "Explicitly installed packages: %s"
msgstr "" msgstr ""
#: print.go:130 #: print.go:40
msgid "First Submitted" msgid "First Submitted"
msgstr "" msgstr ""
@ -218,7 +212,7 @@ msgstr ""
msgid "GenDB finished. No packages were installed" msgid "GenDB finished. No packages were installed"
msgstr "" msgstr ""
#: print.go:119 #: print.go:29
msgid "Groups" msgid "Groups"
msgstr "" msgstr ""
@ -234,23 +228,23 @@ msgstr ""
msgid "Installing %s will remove:" msgid "Installing %s will remove:"
msgstr "" msgstr ""
#: print.go:114 #: print.go:24
msgid "Keywords" msgid "Keywords"
msgstr "" msgstr ""
#: print.go:131 #: print.go:41
msgid "Last Modified" msgid "Last Modified"
msgstr "" msgstr ""
#: print.go:120 #: print.go:30
msgid "Licenses" msgid "Licenses"
msgstr "" msgstr ""
#: print.go:127 #: print.go:37
msgid "Maintainer" msgid "Maintainer"
msgstr "" msgstr ""
#: print.go:123 #: print.go:33
msgid "Make Deps" msgid "Make Deps"
msgstr "" msgstr ""
@ -262,7 +256,7 @@ msgstr ""
msgid "Missing AUR Packages:" msgid "Missing AUR Packages:"
msgstr "" msgstr ""
#: print.go:113 #: print.go:23
msgid "Name" msgid "Name"
msgstr "" msgstr ""
@ -270,7 +264,7 @@ msgstr ""
msgid "None" msgid "None"
msgstr "" msgstr ""
#: print.go:125 #: print.go:35
msgid "Optional Deps" msgid "Optional Deps"
msgstr "" msgstr ""
@ -278,8 +272,8 @@ msgstr ""
msgid "Orphaned AUR Packages:" msgid "Orphaned AUR Packages:"
msgstr "" msgstr ""
#: print.go:134 #: print.go:44
#: print.go:136 #: print.go:46
msgid "Out-of-date" msgid "Out-of-date"
msgstr "" msgstr ""
@ -287,49 +281,49 @@ msgstr ""
msgid "PGP keys need importing:" msgid "PGP keys need importing:"
msgstr "" msgstr ""
#: install.go:258 #: install.go:242
#: vcs.go:50 #: vcs.go:50
msgid "PKGBUILD up to date, Skipping (%d/%d): %s" msgid "PKGBUILD up to date, Skipping (%d/%d): %s"
msgstr "" msgstr ""
#: install.go:718 #: pkg/menus/edit_menu.go:123
msgid "PKGBUILDs to edit?" msgid "PKGBUILDs to edit?"
msgstr "" msgstr ""
#: print.go:141 #: print.go:51
msgid "Package Base ID" msgid "Package Base ID"
msgstr "" msgstr ""
#: print.go:142 #: print.go:52
msgid "Package Base" msgid "Package Base"
msgstr "" msgstr ""
#: install.go:631 #: pkg/menus/clean_menu.go:44
msgid "Packages to cleanBuild?" msgid "Packages to cleanBuild?"
msgstr "" msgstr ""
#: upgrade.go:185 #: upgrade.go:186
msgid "Packages to exclude: (eg: \"1 2 3\", \"1-3\", \"^4\" or repo name)" msgid "Packages to exclude: (eg: \"1 2 3\", \"1-3\", \"^4\" or repo name)"
msgstr "" msgstr ""
#: cmd.go:408 #: cmd.go:365
msgid "Packages to install (eg: 1 2 3, 1-3 or ^4)" msgid "Packages to install (eg: 1 2 3, 1-3 or ^4)"
msgstr "" msgstr ""
#: upgrade.go:182 #: upgrade.go:183
msgid "Packages to upgrade." msgid "Packages to upgrade."
msgstr "" msgstr ""
#: print.go:129 #: print.go:39
msgid "Popularity" msgid "Popularity"
msgstr "" msgstr ""
#: install.go:295 #: pkg/menus/diff_menu.go:169
#: install.go:339 #: pkg/menus/edit_menu.go:134
msgid "Proceed with install?" msgid "Proceed with install?"
msgstr "" msgstr ""
#: print.go:121 #: print.go:31
msgid "Provides" msgid "Provides"
msgstr "" msgstr ""
@ -337,74 +331,73 @@ msgstr ""
msgid "Querying AUR..." msgid "Querying AUR..."
msgstr "" msgstr ""
#: install.go:225 #: install.go:213
msgid "Remove make dependencies after install?" msgid "Remove make dependencies after install?"
msgstr "" msgstr ""
#: pkg/dep/depPool.go:542 #: pkg/dep/depPool.go:541
msgid "Repository AUR" msgid "Repository AUR"
msgstr "" msgstr ""
#: print.go:112 #: print.go:22
#: pkg/db/ialpm/alpm.go:175 #: pkg/db/ialpm/alpm.go:174
msgid "Repository" msgid "Repository"
msgstr "" msgstr ""
#: upgrade.go:67 #: upgrade.go:68
msgid "Searching AUR for updates..." msgid "Searching AUR for updates..."
msgstr "" msgstr ""
#: upgrade.go:56 #: upgrade.go:57
msgid "Searching databases for updates..." msgid "Searching databases for updates..."
msgstr "" msgstr ""
#: cmd.go:405 #: pkg/query/source.go:61
#: query.go:201
msgid "Showing repo packages only" msgid "Showing repo packages only"
msgstr "" msgstr ""
#: print.go:143 #: print.go:53
msgid "Snapshot URL" msgid "Snapshot URL"
msgstr "" msgstr ""
#: print.go:178 #: print.go:88
msgid "Ten biggest packages:" msgid "Ten biggest packages:"
msgstr "" msgstr ""
#: install.go:529 #: install.go:461
msgid "The following packages are not compatible with your architecture:" msgid "The following packages are not compatible with your architecture:"
msgstr "" msgstr ""
#: pkg/db/ialpm/alpm.go:164 #: pkg/db/ialpm/alpm.go:163
#: pkg/dep/depPool.go:539 #: pkg/dep/depPool.go:538
msgid "There are %d providers available for %s:\n" msgid "There are %d providers available for %s:\n"
msgstr "" msgstr ""
#: pkg/settings/exe/cmd_builder.go:129 #: pkg/settings/exe/cmd_builder.go:199
msgid "There may be another Pacman instance running. Waiting..." msgid "There may be another Pacman instance running. Waiting..."
msgstr "" msgstr ""
#: print.go:176 #: print.go:86
msgid "Total Size occupied by packages: %s" msgid "Total Size occupied by packages: %s"
msgstr "" msgstr ""
#: print.go:174 #: print.go:84
msgid "Total foreign installed packages: %s" msgid "Total foreign installed packages: %s"
msgstr "" msgstr ""
#: print.go:173 #: print.go:83
msgid "Total installed packages: %s" msgid "Total installed packages: %s"
msgstr "" msgstr ""
#: install.go:537 #: install.go:469
msgid "Try to build them anyway?" msgid "Try to build them anyway?"
msgstr "" msgstr ""
#: print.go:117 #: print.go:27
msgid "URL" msgid "URL"
msgstr "" msgstr ""
#: clean.go:183 #: clean.go:182
msgid "Unable to clean:" msgid "Unable to clean:"
msgstr "" msgstr ""
@ -413,30 +406,28 @@ msgstr ""
msgid "Unable to find the following packages:" msgid "Unable to find the following packages:"
msgstr "" msgstr ""
#: print.go:115 #: print.go:25
msgid "Version" msgid "Version"
msgstr "" msgstr ""
#: print.go:128 #: print.go:38
msgid "Votes" msgid "Votes"
msgstr "" msgstr ""
#: print.go:171 #: print.go:81
msgid "Yay version v%s" msgid "Yay version v%s"
msgstr "" msgstr ""
#: install.go:632 #: pkg/menus/menu.go:48
#: install.go:711
#: install.go:719
msgid "[N]one" msgid "[N]one"
msgstr "" msgstr ""
#: clean.go:78 #: clean.go:77
msgid "\nBuild directory:" msgid "\nBuild directory:"
msgstr "" msgstr ""
#: pkg/db/ialpm/alpm.go:185 #: pkg/db/ialpm/alpm.go:184
#: pkg/dep/depPool.go:552 #: pkg/dep/depPool.go:551
msgid "\nEnter a number (default=1): " msgid "\nEnter a number (default=1): "
msgstr "" msgstr ""
@ -448,20 +439,16 @@ msgstr ""
msgid "\nPackage conflicts found:" msgid "\nPackage conflicts found:"
msgstr "" msgstr ""
#: install.go:296 #: pkg/settings/errors.go:29
#: install.go:340
#: install.go:538
#: install.go:643
#: install.go:730
msgid "aborting due to user" msgid "aborting due to user"
msgstr "" msgstr ""
#: install.go:564 #: install.go:496
msgid "cannot find package name: %v" msgid "cannot find package name: %v"
msgstr "" msgstr ""
#: install.go:977 #: install.go:688
#: install.go:1110 #: install.go:821
msgid "could not find PKGDEST for: %s" msgid "could not find PKGDEST for: %s"
msgstr "" msgstr ""
@ -469,7 +456,7 @@ msgstr ""
msgid "devel check for package failed: '%s' encountered an error" msgid "devel check for package failed: '%s' encountered an error"
msgstr "" msgstr ""
#: install.go:810 #: pkg/menus/edit_menu.go:108
msgid "editor did not exit successfully, aborting: %s" msgid "editor did not exit successfully, aborting: %s"
msgstr "" msgstr ""
@ -477,27 +464,23 @@ msgstr ""
msgid "error downloading sources: %s" msgid "error downloading sources: %s"
msgstr "" msgstr ""
#: query.go:200
msgid "error during AUR search: %s"
msgstr ""
#: pkg/download/errors.go:25 #: pkg/download/errors.go:25
msgid "error fetching %s: %s" msgid "error fetching %s: %s"
msgstr "" msgstr ""
#: install.go:365 #: install.go:299
#: install.go:473 #: install.go:405
msgid "error installing repo packages" msgid "error installing repo packages"
msgstr "" msgstr ""
#: install.go:960 #: install.go:671
#: install.go:1001 #: install.go:712
#: install.go:1015 #: install.go:726
#: install.go:1029 #: install.go:740
msgid "error making: %s" msgid "error making: %s"
msgstr "" msgstr ""
#: diff.go:141 #: install.go:573
msgid "error merging %s: %s" msgid "error merging %s: %s"
msgstr "" msgstr ""
@ -505,51 +488,49 @@ msgstr ""
msgid "error reading %s" msgid "error reading %s"
msgstr "" msgstr ""
#: install.go:93 #: install.go:88
msgid "error refreshing databases" msgid "error refreshing databases"
msgstr "" msgstr ""
#: clean.go:213 #: clean.go:212
#: diff.go:134 #: install.go:566
msgid "error resetting %s: %s" msgid "error resetting %s: %s"
msgstr "" msgstr ""
#: install.go:46 #: install.go:42
msgid "error updating package install reason to dependency" msgid "error updating package install reason to dependency"
msgstr "" msgstr ""
#: install.go:64 #: install.go:60
msgid "error updating package install reason to explicit" msgid "error updating package install reason to explicit"
msgstr "" msgstr ""
#: pkg/settings/dirs.go:54 #: pkg/settings/errors.go:23
msgid "failed to create directory '%s': %s" msgid "failed to create directory '%s': %s"
msgstr "" msgstr ""
#: pkg/settings/config.go:252 #: pkg/settings/config.go:283
msgid "failed to open config file '%s': %s" msgid "failed to open config file '%s': %s"
msgstr "" msgstr ""
#: install.go:829 #: install.go:522
msgid "failed to parse %s -- skipping: %s" msgid "failed to parse %s -- skipping: %s"
msgstr "" msgstr ""
#: install.go:833 #: install.go:526
msgid "failed to parse %s: %s" msgid "failed to parse %s: %s"
msgstr "" msgstr ""
#: pkg/settings/config.go:262 #: pkg/settings/config.go:293
msgid "failed to read config file '%s': %s" msgid "failed to read config file '%s': %s"
msgstr "" msgstr ""
#: cmd.go:419 #: pkg/text/errors.go:8
#: config.go:110
#: pkg/dep/depPool.go:569
msgid "input too long" msgid "input too long"
msgstr "" msgstr ""
#: pkg/db/ialpm/alpm.go:215 #: pkg/db/ialpm/alpm.go:205
#: pkg/dep/depPool.go:579 #: pkg/dep/depPool.go:571
msgid "invalid number: %s" msgid "invalid number: %s"
msgstr "" msgstr ""
@ -557,7 +538,7 @@ msgstr ""
msgid "invalid option '%s'" msgid "invalid option '%s'"
msgstr "" msgstr ""
#: cmd.go:199 #: cmd.go:198
msgid "invalid option: '--deps' and '--explicit' may not be used together" msgid "invalid option: '--deps' and '--explicit' may not be used together"
msgstr "" msgstr ""
@ -565,17 +546,14 @@ msgstr ""
msgid "invalid repository" msgid "invalid repository"
msgstr "" msgstr ""
#: cmd.go:400 #: pkg/query/errors.go:20
#: cmd.go:436 #: pkg/query/types.go:105
#: cmd.go:453 #: pkg/query/types.go:150
#: print.go:33
#: print.go:78
#: query.go:196
msgid "invalid sort mode. Fix with yay -Y --bottomup --save" msgid "invalid sort mode. Fix with yay -Y --bottomup --save"
msgstr "" msgstr ""
#: pkg/db/ialpm/alpm.go:220 #: pkg/db/ialpm/alpm.go:210
#: pkg/dep/depPool.go:584 #: pkg/dep/depPool.go:576
msgid "invalid value: %d is not between %d and %d" msgid "invalid value: %d is not between %d and %d"
msgstr "" msgstr ""
@ -583,8 +561,8 @@ msgstr ""
msgid "no keys to import" msgid "no keys to import"
msgstr "" msgstr ""
#: cmd.go:379 #: pkg/query/errors.go:27
msgid "no packages match search" msgid "no query was executed"
msgstr "" msgstr ""
#: pkg/text/text.go:60 #: pkg/text/text.go:60
@ -595,7 +573,7 @@ msgstr ""
msgid "only one operation may be used at a time" msgid "only one operation may be used at a time"
msgstr "" msgstr ""
#: print.go:269 #: print.go:179
msgid "package '%s' was not found" msgid "package '%s' was not found"
msgstr "" msgstr ""
@ -615,35 +593,31 @@ msgstr ""
msgid "problem importing keys" msgid "problem importing keys"
msgstr "" msgstr ""
#: install.go:184 #: clean.go:97
msgid "refusing to install AUR packages as root, aborting"
msgstr ""
#: clean.go:98
msgid "removing AUR packages from cache..." msgid "removing AUR packages from cache..."
msgstr "" msgstr ""
#: clean.go:168 #: clean.go:167
#: clean.go:199 #: clean.go:198
msgid "removing untracked AUR files from cache..." msgid "removing untracked AUR files from cache..."
msgstr "" msgstr ""
#: install.go:1119 #: install.go:830
msgid "the PKGDEST for %s is listed by makepkg but does not exist: %s" msgid "the PKGDEST for %s is listed by makepkg but does not exist: %s"
msgstr "" msgstr ""
#: pkg/db/ialpm/alpm.go:240 #: pkg/db/ialpm/alpm.go:230
msgid "unable to CreateHandle: %s" msgid "unable to CreateHandle: %s"
msgstr "" msgstr ""
#: cmd.go:188 #: cmd.go:187
msgid "unhandled operation" msgid "unhandled operation"
msgstr "" msgstr ""
#: cmd.go:500 #: cmd.go:421
msgid "unknown-version" msgid "unknown-version"
msgstr "" msgstr ""
#: pkg/text/text.go:59 #: pkg/text/text.go:59
msgid "yes" msgid "yes"
msgstr "" msgstr ""