1
0
mirror of https://github.com/Jguer/yay synced 2024-07-05 09:50:44 +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
}
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)"))
numberBuf, err := text.GetInput("", false)

View File

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

284
po/en.po
View File

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