1
0
mirror of https://github.com/Jguer/yay synced 2024-07-01 07:56:37 +00:00

Compare commits

...

16 Commits

Author SHA1 Message Date
iTrooz
36819c8abe
Merge a77d98824d into 836fc5922a 2024-06-28 16:40:50 +02:00
Daniel Oh
836fc5922a
add short option for --repo (#2380)
* add short option for --repo

* run pre-commit

* update man page

* add fish completion

* add a N options

* add long options

---------

Co-authored-by: jguer <me@jguer.space>
2024-06-28 16:40:35 +02:00
Joey Holtzman
0165486bf4
Respect provided targets when using -Si flag (#2460) 2024-06-28 16:39:49 +02:00
iTrooz
a77d98824d
fix typo 2024-06-20 14:34:58 +02:00
iTrooz
a386ab39ff
fix line length 2024-06-20 14:34:45 +02:00
iTrooz
8f94e3845c
upgradeId -> upgradeID 2024-06-20 14:34:08 +02:00
iTrooz
c219e6dfa1
replace else/if by else if 2024-06-20 14:33:51 +02:00
iTrooz
9ffcf6921c
remove useless condition 2024-06-06 16:33:54 +02:00
iTrooz
af8547ac98
mentionned -> mentioned 2024-06-06 16:31:03 +02:00
iTrooz
29aded7b0c
introduce upgradeId 2024-06-06 16:28:44 +02:00
iTrooz
24141bae1e
fix comment 2024-06-06 16:23:06 +02:00
iTrooz
30cd762fd7
remove useless continue instructions 2024-06-06 16:22:44 +02:00
iTrooz
02e5f10287
simplify if noIncludes 2024-06-06 16:22:29 +02:00
iTrooz
48bc919821
isInclude -> noIncludes 2024-06-06 16:20:59 +02:00
iTrooz
78884701e6
simplify last condition 2024-06-06 16:20:31 +02:00
iTrooz
88f1780f2b
add comments 2024-06-06 16:20:25 +02:00
9 changed files with 34 additions and 24 deletions

2
cmd.go
View File

@ -54,7 +54,7 @@ If no operation is specified 'yay -Syu' will be performed
If no operation is specified and targets are provided -Y will be assumed
New options:
--repo Assume targets are from the repositories
-N --repo Assume targets are from the repositories
-a --aur Assume targets are from the AUR
Permanent configuration options:

View File

@ -61,8 +61,8 @@ _yay() {
search unrequired upgrades' 'c e g i k l m n o p s t u')
remove=('cascade dbonly nodeps assume-installed nosave print recursive unneeded' 'c n p s u')
sync=('asdeps asexplicit clean dbonly downloadonly overwrite groups ignore ignoregroup
info list needed nodeps assume-installed print refresh recursive search sysupgrade'
'c g i l p s u w y')
info list needed nodeps assume-installed print refresh recursive search sysupgrade aur repo'
'c g i l p s u w y a N')
upgrade=('asdeps asexplicit overwrite needed nodeps assume-installed print recursive' 'p')
core=('database files help query remove sync upgrade version' 'D F Q R S U V h')

View File

@ -165,7 +165,7 @@ complete -c $progname -n "$webspecific" -s u -l unvote -d 'Unvote for AUR packag
complete -c $progname -n "$webspecific" -xa "$listall"
# New options
complete -c $progname -n "not $noopt" -l repo -d 'Assume targets are from the AUR' -f
complete -c $progname -n "not $noopt" -s N -l repo -d 'Assume targets are from the AUR' -f
complete -c $progname -n "not $noopt" -s a -l aur -d 'Assume targets are from the repositories' -f
# Yay options

View File

@ -23,7 +23,7 @@ _pacman_opts_commands=(
# options for passing to _arguments: options common to all commands
_pacman_opts_common=(
'--repo[Assume targets are from the repositories]'
{-N,--repo}'[Assume targets are from the repositories]'
{-a,--aur}'[Assume targets are from the AUR]'
'--aururl[Set an alternative AUR URL]:url'
'--aurrpcurl[Set an alternative URL for the AUR /rpc endpoint]:url'

View File

@ -63,7 +63,7 @@ Yay will also remove cached data about devel packages.
.SH NEW OPTIONS
.TP
.B \-\-repo
.B \-N, \-\-repo
Assume all targets are from the repositories. Additionally Actions such as
sysupgrade will only act on repository packages.

View File

@ -169,7 +169,7 @@ func (c *Configuration) handleOption(option, value string) bool {
c.CombinedUpgrade = boolValue
case "a", "aur":
c.Mode = parser.ModeAUR
case "repo":
case "N", "repo":
c.Mode = parser.ModeRepo
case "removemake":
c.RemoveMake = "yes"

View File

@ -425,7 +425,7 @@ func isArg(arg string) bool {
case "useask":
case "combinedupgrade":
case "a", "aur":
case "repo":
case "N", "repo":
case "removemake":
case "noremovemake":
case "askremovemake":

View File

@ -302,28 +302,32 @@ func (u *UpgradeService) UserExcludeUpgrades(graph *topo.Graph[string, *dep.Inst
// upgrade menu asks you which packages to NOT upgrade so in this case
// exclude and include are kind of swapped
exclude, include, otherExclude, otherInclude := intrange.ParseNumberMenu(numbers)
isInclude := len(include) == 0 && otherInclude.Cardinality() == 0
// true if user doesn't want to include specific repositories/packages
noIncludes := len(include) == 0 && otherInclude.Cardinality() == 0
excluded := make([]string, 0)
for i := range allUp.Up {
up := &allUp.Up[i]
upgradeID := len(allUp.Up) - i
if isInclude && otherExclude.Contains(up.Repository) {
// check if user wants to exclude specific things (true) or include specific things
if noIncludes {
// exclude repositories mentioned by the user
if otherExclude.Contains(up.Repository) {
u.log.Debugln("pruning", up.Name)
excluded = append(excluded, graph.Prune(up.Name)...)
}
// exclude packages mentioned by the user
if exclude.Get(upgradeID) {
u.log.Debugln("pruning", up.Name)
excluded = append(excluded, graph.Prune(up.Name)...)
}
// If the user explicitly wants to include a package/repository, exclude everything else
} else if !include.Get(upgradeID) && !otherInclude.Contains(up.Repository) {
u.log.Debugln("pruning", up.Name)
excluded = append(excluded, graph.Prune(up.Name)...)
continue
}
if isInclude && exclude.Get(len(allUp.Up)-i) {
u.log.Debugln("pruning", up.Name)
excluded = append(excluded, graph.Prune(up.Name)...)
continue
}
if !isInclude && !(include.Get(len(allUp.Up)-i) || otherInclude.Contains(up.Repository)) {
u.log.Debugln("pruning", up.Name)
excluded = append(excluded, graph.Prune(up.Name)...)
continue
}
}

View File

@ -46,7 +46,13 @@ func syncInfo(ctx context.Context, run *runtime.Runtime,
aurS, repoS := packageSlices(pkgS, run.Cfg, dbExecutor)
if len(repoS) == 0 && len(aurS) == 0 {
aurS = dbExecutor.InstalledRemotePackageNames()
if run.Cfg.Mode != parser.ModeRepo {
aurS = dbExecutor.InstalledRemotePackageNames()
}
if run.Cfg.Mode != parser.ModeAUR {
repoS = dbExecutor.InstalledSyncPackageNames()
}
}
if len(aurS) != 0 {