Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completions/fish: refine from pacman 5.2.0 and yay 9.4.2 #1100

Merged
merged 1 commit into from
Oct 29, 2019
Merged

completions/fish: refine from pacman 5.2.0 and yay 9.4.2 #1100

merged 1 commit into from
Oct 29, 2019

Conversation

akiirui
Copy link
Contributor

@akiirui akiirui commented Oct 25, 2019

Base fish-shell: completions/pacman.fish: Update for pacman 5.2

And yay 9.4.2 options from manpages.

@akiirui akiirui marked this pull request as ready for review October 27, 2019 10:56
@Morganamilo
Copy link
Contributor

What's up with all the quotation changes? Is that from you or upstream? My local pacman.fish seems to still have them unquoted.

I'd rather our completions purely add to pacman's and follow their conventions for diff and maintaining sake.

@akiirui
Copy link
Contributor Author

akiirui commented Oct 29, 2019

What's up with all the quotation changes? Is that from you or upstream? My local pacman.fish seems to still have them unquoted.

I'd rather our completions purely add to pacman's and follow their conventions for diff and maintaining sake.

Oh, that base pacman completion just recently merged to fish-shell/master.

I open a draft pull request before. and not marked ready for review until upstream merged pacman.fish.

Here is diff about this yay.fish with upstream new pacman.fish.
(I'm sorry for I can not show you changes between this yay.fish and current. That too many)

If necessary, can wait for fish-shell release these changes.

--- pacman.fish	2019-10-29 07:55:14.319381793 +0800
+++ yay.fish	2019-10-29 07:55:10.223024406 +0800
@@ -1,16 +1,21 @@
-# Completions for pacman
-# Author: Giorgio Lando <[email protected]>
-# Updated by maxfl, SanskritFritz, faho, f1u77y, akiirui
-
-set -l progname pacman
+# vim:fdm=marker foldlevel=0 tabstop=2 shiftwidth=2 filetype=fish
+# Original Author for pacman: Giorgio Lando <[email protected]>
+# Updated for yay by jguer
+
+set -l progname yay
+
+# Yay constants
+set -l noopt 'not __fish_contains_opt -s Y -s G -s V -s P -s S -s D -s Q -s R -s U -s T -s F database query sync remove upgrade deptest files version'
+set -l listall "(yay -Pc)"
+set -l listpacman "(__fish_print_packages)"
+set -l yayspecific '__fish_contains_opt -s Y yay'
+set -l show '__fish_contains_opt -s P show'
+set -l getpkgbuild '__fish_contains_opt -s G getpkgbuild'
 
+# Pacman constants
 set -l listinstalled "(pacman -Q | string replace ' ' \t)"
-# This might be an issue if another package manager is also installed (e.g. for containers)
-set -l listall "(__fish_print_packages)"
 set -l listrepos "(__fish_print_pacman_repos)"
 set -l listgroups "(pacman -Sg)\t'Package Group'"
-
-set -l noopt 'not __fish_contains_opt -s S -s D -s Q -s R -s U -s T -s F database query sync remove upgrade deptest files'
 set -l database '__fish_contains_opt -s D database'
 set -l query '__fish_contains_opt -s Q query'
 set -l remove '__fish_contains_opt -s R remove'
@@ -32,7 +37,7 @@
 complete -c $progname -s T -f -l deptest -n "$noopt" -d 'Check dependencies'
 complete -c $progname -s U -f -l upgrade -n "$noopt" -d 'Upgrade or add a local package'
 complete -c $progname -s F -f -l files -n "$noopt" -d 'Query the files database'
-complete -c $progname -s V -f -l version -d 'Display version and exit'
+complete -c $progname -s V -f -l version -n "$noopt" -d 'Display version and exit'
 complete -c $progname -s h -f -l help -d 'Display help'
 
 # General options
@@ -105,7 +110,7 @@
 # File options - since pacman 5
 complete -c $progname -n "$files" -s x -l regex -d 'Interpret each query as a regular expression' -f
 complete -c $progname -n "$files" -l machinereadable -d 'Print each match in a machine readable output format' -f
-complete -c $progname -n "$files" -d 'Package' -xa "$listall"
+complete -c $progname -n "$files" -d 'Package' -xa "$listpacman"
 
 # Query options
 complete -c $progname -n "$query" -s c -l changelog -d 'View the change log of PACKAGE' -f
@@ -143,3 +148,99 @@
 # In practice, it's going to be tar.xz, tar.gz or tar.zst
 # Using "pkg.tar.*" here would change __fish_complete_suffix's descriptions to "unknown"
 complete -c $progname -n "$upgrade" -d 'Package file' -xa "(__fish_complete_suffix .pkg.tar\{,.xz,.gz,.zst\})"
+
+# Yay operations
+complete -c $progname -s Y -f -l yay -n "$noopt" -d 'Yay specific operations'
+complete -c $progname -s P -f -l show -n "$noopt" -d 'Print information'
+complete -c $progname -s G -f -l getpkgbuild -n "$noopt" -d 'Get PKGBUILD from ABS or AUR'
+
+# 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 a -l aur -d 'Assume targets are from the repositories' -f
+
+# Yay options
+complete -c $progname -n "$yayspecific" -s c -l clean -d 'Remove unneeded dependencies' -f
+complete -c $progname -n "$yayspecific" -l gendb -d 'Generate development package DB' -f
+
+# Show options
+complete -c $progname -n "$show" -s c -l complete -d 'Print a list of all AUR and repo packages' -f
+#complete -c $progname -n "$show" -s f -l fish -d 'During complete adjust the output for the fish shell' -f
+complete -c $progname -n "$show" -s d -l defaultconfig -d 'Print default yay configuration' -f
+complete -c $progname -n "$show" -s g -l currentconfig -d 'Print current yay configuration' -f
+complete -c $progname -n "$show" -s s -l stats -d 'Display system package statistics' -f
+complete -c $progname -n "$show" -s w -l news -d 'Print arch news' -f
+complete -c $progname -n "$show" -s q -l quiet -d 'Do not print news description' -f
+
+# Getpkgbuild options
+complete -c $progname -n "$getpkgbuild" -s f -l force -d 'Force download for existing tar packages' -f
+complete -c $progname -n "$getpkgbuild" -xa "$listall"
+
+# Premenent configuration settings
+complete -c $progname -n "not $noopt" -l save -d 'Save current arguments to yay permanent configuration' -f
+complete -c $progname -n "not $noopt" -l aururl -d 'Set an alternative AUR URL' -f
+complete -c $progname -n "not $noopt" -l builddir -d 'Directory to use for Building AUR Packages' -rF
+complete -c $progname -n "not $noopt" -l absdir -d 'Directory used to store downloads from the ABS' -rF
+complete -c $progname -n "not $noopt" -l editor -d 'Editor to use' -f
+complete -c $progname -n "not $noopt" -l editorflags -d 'Editor flags to use' -f
+complete -c $progname -n "not $noopt" -l makepkg -d 'Makepkg command to use' -f
+complete -c $progname -n "not $noopt" -l pacman -d 'Pacman command to use' -f
+complete -c $progname -n "not $noopt" -l tar -d 'Tar command to use' -f
+complete -c $progname -n "not $noopt" -l git -d 'Git command to use' -f
+complete -c $progname -n "not $noopt" -l gpg -d 'Gpg command to use' -f
+complete -c $progname -n "not $noopt" -l config -d 'The pacman config file to use' -rF
+complete -c $progname -n "not $noopt" -l makepkgconf -d 'Use custom makepkg.conf location' -rF
+complete -c $progname -n "not $noopt" -l nomakepkgconf -d 'Use default makepkg.conf' -f
+complete -c $progname -n "not $noopt" -l requestsplitn -d 'Max amount of packages to query per AUR request' -f
+complete -c $progname -n "not $noopt" -l completioninterval -d 'Refresh interval for completion cache' -f
+complete -c $progname -n "not $noopt" -l sortby -d 'Sort AUR results by a specific field during search' -xa "{votes,popularity,id,baseid,name,base,submitted,modified}"
+complete -c $progname -n "not $noopt" -l searchby -d 'Search for AUR packages by querying the specified field' -xa "{name,name-desc,maintainer,depends,checkdepends,makedepends,optdepends}"
+complete -c $progname -n "not $noopt" -l answerclean -d 'Set a predetermined answer for the clean build menu' -xa "{All,None,Installed,NotInstalled}"
+complete -c $progname -n "not $noopt" -l answerdiff -d 'Set a predetermined answer for the edit diff menu' -xa "{All,None,Installed,NotInstalled}"
+complete -c $progname -n "not $noopt" -l answeredit -d 'Set a predetermined answer for the edit pkgbuild menu' -xa "{All,None,Installed,NotInstalled}"
+complete -c $progname -n "not $noopt" -l answerupgrade -d 'Set a predetermined answer for the upgrade menu' -f
+complete -c $progname -n "not $noopt" -l noanswerclean -d 'Unset the answer for the clean build menu' -f
+complete -c $progname -n "not $noopt" -l noanswerdiff -d 'Unset the answer for the diff menu' -f
+complete -c $progname -n "not $noopt" -l noansweredit -d 'Unset the answer for the edit pkgbuild menu' -f
+complete -c $progname -n "not $noopt" -l noanswerupgrade -d 'Unset the answer for the upgrade menu' -f
+complete -c $progname -n "not $noopt" -l cleanmenu -d 'Give the option to clean build PKGBUILDS' -f
+complete -c $progname -n "not $noopt" -l diffmenu -d 'Give the option to show diffs for build files' -f
+complete -c $progname -n "not $noopt" -l editmenu -d 'Give the option to edit/view PKGBUILDS' -f
+complete -c $progname -n "not $noopt" -l upgrademenu -d 'Show a detailed list of updates with the option to skip any' -f
+complete -c $progname -n "not $noopt" -l nocleanmenu -d 'Do not clean build PKGBUILDS' -f
+complete -c $progname -n "not $noopt" -l nodiffmenu -d 'Do not show diffs for build files' -f
+complete -c $progname -n "not $noopt" -l noeditmenu -d 'Do not edit/view PKGBUILDS' -f
+complete -c $progname -n "not $noopt" -l noupgrademenu -d 'Do not show the upgrade menu' -f
+complete -c $progname -n "not $noopt" -l askremovemake -d 'Ask to remove make deps after install' -f
+complete -c $progname -n "not $noopt" -l removemake -d 'Remove make deps after install' -f
+complete -c $progname -n "not $noopt" -l noremovemake -d 'Do not remove make deps after install' -f
+complete -c $progname -n "not $noopt" -l topdown -d 'Shows repository packages first and then aur' -f
+complete -c $progname -n "not $noopt" -l bottomup -d 'Shows aur packages first and then repository' -f
+complete -c $progname -n "not $noopt" -l devel -d 'Check -git/-svn/-hg development version' -f
+complete -c $progname -n "not $noopt" -l nodevel -d 'Disable development version checking' -f
+complete -c $progname -n "not $noopt" -l gitclone -d 'Use git to download and update PKGBUILDs' -f
+complete -c $progname -n "not $noopt" -l nogitclone -d 'Download and update PKGBUILDs using tarballs' -f
+complete -c $progname -n "not $noopt" -l cleanafter -d 'Clean package sources after successful build' -f
+complete -c $progname -n "not $noopt" -l nocleanafter -d 'Disable package sources cleaning' -f
+complete -c $progname -n "not $noopt" -l timeupdate -d 'Check package modification date and version' -f
+complete -c $progname -n "not $noopt" -l notimeupdate -d 'Check only package version change' -f
+complete -c $progname -n "not $noopt" -l redownload -d 'Redownload PKGBUILD of package even if up-to-date' -f
+complete -c $progname -n "not $noopt" -l redownloadall -d 'Redownload PKGBUILD of package and deps even if up-to-date' -f
+complete -c $progname -n "not $noopt" -l noredownload -d 'Do not redownload up-to-date PKGBUILDs' -f
+complete -c $progname -n "not $noopt" -l provides -d 'Look for matching providers when searching for packages' -f
+complete -c $progname -n "not $noopt" -l noprovides -d 'Just look for packages by pkgname' -f
+complete -c $progname -n "not $noopt" -l pgpfetch -d 'Prompt to import PGP keys from PKGBUILDs' -f
+complete -c $progname -n "not $noopt" -l nopgpfetch -d 'Do not prompt to import PGP keys' -f
+complete -c $progname -n "not $noopt" -l useask -d 'Automatically resolve conflicts using pacmans ask flag' -f
+complete -c $progname -n "not $noopt" -l nouseask -d 'Confirm conflicts manually during the install' -f
+complete -c $progname -n "not $noopt" -l combinedupgrade -d 'Refresh then perform the repo and AUR upgrade together' -f
+complete -c $progname -n "not $noopt" -l nocombinedupgrade -d 'Perform the repo upgrade and AUR upgrade separately' -f
+complete -c $progname -n "not $noopt" -l batchinstall -d 'Build multiple AUR packages then install them together' -f
+complete -c $progname -n "not $noopt" -l nobatchinstall -d 'Build and install each AUR package one by one' -f
+complete -c $progname -n "not $noopt" -l rebuild -d 'Always build target packages' -f
+complete -c $progname -n "not $noopt" -l rebuildall -d 'Always build all AUR packages' -f
+complete -c $progname -n "not $noopt" -l rebuildtree -d 'Always build all AUR packages even if installed' -f
+complete -c $progname -n "not $noopt" -l norebuild -d 'Skip package build if in cache and up to date' -f
+complete -c $progname -n "not $noopt" -l mflags -d 'Pass the following options to makepkg' -f
+complete -c $progname -n "not $noopt" -l gpgflags -d 'Pass the following options to gpg' -f
+complete -c $progname -n "not $noopt" -l sudoloop -d 'Loop sudo calls in the background to avoid timeout' -f
+complete -c $progname -n "not $noopt" -l nosudoloop -d 'Do not loop sudo calls in the background' -f

@Morganamilo
Copy link
Contributor

No that's fine, I just wanted to know where all the style changes came from and a smaller diff. Although it would help if you set the language to diff in your comment :P

@Morganamilo
Copy link
Contributor

-complete -c $progname -s V -f -l version -d 'Display version and exit'
+complete -c $progname -s V -f -l version -n "$noopt" -d 'Display version and exit'

-complete -c $progname -n "$files" -d 'Package' -xa "$listall"
+complete -c $progname -n "$files" -d 'Package' -xa "$listpacman"

What's with these chanegs?

@akiirui
Copy link
Contributor Author

akiirui commented Oct 29, 2019

-complete -c $progname -s V -f -l version -d 'Display version and exit'
+complete -c $progname -s V -f -l version -n "$noopt" -d 'Display version and exit'

Because yay -V cannot work with other primary options, like:

$ yay -SV
> only one operation may be used at a time

But pacman can do this.

-complete -c $progname -n "$files" -d 'Package' -xa "$listall"
+complete -c $progname -n "$files" -d 'Package' -xa "$listpacman"

Because pacman -F --files options only query in repository database. Cannot query files in AUR packages.


These changes also can find in current yay.fish.

@Morganamilo
Copy link
Contributor

Makes sense.

@Morganamilo Morganamilo merged commit 662ce99 into Jguer:master Oct 29, 2019
@KokaKiwi
Copy link

I have errors on my fish (version 3.0.2 on Arch Linux), saying complete: Unknown option “-rF” on yay fish completions file

@Morganamilo
Copy link
Contributor

In what version of yay?

@KokaKiwi
Copy link

yay v9.4.2.r6.g662ce99 - libalpm v12.0.0

@KokaKiwi
Copy link

I use yay with the AUR package yay-git (because i like living on the edge, arch user etc.)

@Morganamilo
Copy link
Contributor

Looks like -F was added in git but is not in the current release... fish-shell/fish-shell@4ebb6cf

That's what happens when I don't test the PR.

@akiirui
Copy link
Contributor Author

akiirui commented Oct 30, 2019

It's my mistake. Sorry about these.

@KokaKiwi
-F is new option of complete in fish-shell 3.1.0 really.
And it's have not release. I forget it...

@Morganamilo
Thanks for fix -F option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants