about summary refs log tree commit diff
diff options
context:
space:
mode:
authortriallax <triallax@tutanota.com>2023-09-20 19:54:16 +0100
committerLeah Neukirchen <leah@vuxu.org>2023-10-22 01:28:11 +0200
commit87845f52f18e1dedc963f1c7a86b33f3248d21fe (patch)
tree0f1a5cccff4b706bb05fe25a9a125d297305b9d5
parenta3742437505609e847ba7e59c60ea395e708e729 (diff)
downloadxtools-87845f52f18e1dedc963f1c7a86b33f3248d21fe.tar.gz
xtools-87845f52f18e1dedc963f1c7a86b33f3248d21fe.tar.xz
xtools-87845f52f18e1dedc963f1c7a86b33f3248d21fe.zip
completions: add fish completions.
-rw-r--r--Makefile2
-rw-r--r--fish/completions/xbarf.fish1
-rw-r--r--fish/completions/xbuildbarf.fish2
-rw-r--r--fish/completions/xbulk.fish4
-rw-r--r--fish/completions/xbump.fish3
-rw-r--r--fish/completions/xchangelog.fish2
-rw-r--r--fish/completions/xcheckmypkgs.fish1
-rw-r--r--fish/completions/xcheckrestart.fish2
-rw-r--r--fish/completions/xchroot.fish2
-rw-r--r--fish/completions/xclash.fish1
-rw-r--r--fish/completions/xdbg.fish2
-rw-r--r--fish/completions/xdiff.fish4
-rw-r--r--fish/completions/xdistdir.fish1
-rw-r--r--fish/completions/xdowngrade.fish2
-rw-r--r--fish/completions/xetcchanges.fish1
-rw-r--r--fish/completions/xgensum.fish6
-rw-r--r--fish/completions/xgrep.fish2
-rw-r--r--fish/completions/xhog.fish1
-rw-r--r--fish/completions/xi.fish1
-rw-r--r--fish/completions/xilog.fish1
-rw-r--r--fish/completions/xlg.fish2
-rw-r--r--fish/completions/xlint.fish2
-rw-r--r--fish/completions/xlocate.fish11
-rw-r--r--fish/completions/xlog.fish2
-rw-r--r--fish/completions/xls.fish2
-rw-r--r--fish/completions/xmandoc.fish1
-rw-r--r--fish/completions/xmksv.fish2
-rw-r--r--fish/completions/xmypkgs.fish2
-rw-r--r--fish/completions/xnew.fish2
-rw-r--r--fish/completions/xnews.fish1
-rw-r--r--fish/completions/xnodev.fish1
-rw-r--r--fish/completions/xoptdiff.fish3
-rw-r--r--fish/completions/xpcdeps.fish1
-rw-r--r--fish/completions/xpkg.fish11
-rw-r--r--fish/completions/xpkgdiff.fish12
-rw-r--r--fish/completions/xpstree.fish1
-rw-r--r--fish/completions/xq.fish3
-rw-r--r--fish/completions/xrecent.fish2
-rw-r--r--fish/completions/xrevbump.fish11
-rw-r--r--fish/completions/xrevshlib.fish2
-rw-r--r--fish/completions/xrs.fish1
-rw-r--r--fish/completions/xsrc.fish2
-rw-r--r--fish/completions/xsubpkg.fish3
-rw-r--r--fish/completions/xuname.fish1
-rw-r--r--fish/completions/xvoidstrap.fish3
-rw-r--r--fish/functions/__xtools_complete_archs.fish3
-rw-r--r--fish/functions/__xtools_complete_one_package.fish4
-rw-r--r--fish/functions/__xtools_complete_packages.fish3
-rw-r--r--fish/functions/__xtools_complete_repo_urls.fish9
49 files changed, 144 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 81f7a90..63fbf37 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,8 @@ all:
 install:
 	for f in x*[!~1]; do install -Dm0755 $$f $(DESTDIR)$(PREFIX)/bin/$$f; done
 	install -Dm644 _xtools $(DESTDIR)/$(PREFIX)/share/zsh/site-functions/_xtools
+	install -Dm644 -t $(DESTDIR)/$(PREFIX)/share/fish/vendor_completions.d -D fish/completions/*
+	install -Dm644 -t $(DESTDIR)/$(PREFIX)/share/fish/vendor_functions.d -D fish/functions/*
 	install -Dm644 xtools.1 $(DESTDIR)/$(PREFIX)/share/man/man1/xtools.1
 	for f in x*[!~1]; do ln -sf xtools.1 $(DESTDIR)$(PREFIX)/share/man/man1/$$f.1; done
 
diff --git a/fish/completions/xbarf.fish b/fish/completions/xbarf.fish
new file mode 100644
index 0000000..cdd5cc5
--- /dev/null
+++ b/fish/completions/xbarf.fish
@@ -0,0 +1 @@
+complete -c xbarf -f
diff --git a/fish/completions/xbuildbarf.fish b/fish/completions/xbuildbarf.fish
new file mode 100644
index 0000000..e89a1b2
--- /dev/null
+++ b/fish/completions/xbuildbarf.fish
@@ -0,0 +1,2 @@
+complete -c xbuildbarf -f
+complete -c xbuildbarf -n '[ (count (commandline -poc)) -eq 1 ]' -a '(__xtools_complete_archs)'
diff --git a/fish/completions/xbulk.fish b/fish/completions/xbulk.fish
new file mode 100644
index 0000000..2e0de25
--- /dev/null
+++ b/fish/completions/xbulk.fish
@@ -0,0 +1,4 @@
+complete -c xbulk -f
+complete -c xbulk -s n -d 'Dry run'
+complete -c xbulk -s k -d 'Keep going on errors'
+complete -c xbulk -a '(__xtools_complete_packages)'
diff --git a/fish/completions/xbump.fish b/fish/completions/xbump.fish
new file mode 100644
index 0000000..14653d5
--- /dev/null
+++ b/fish/completions/xbump.fish
@@ -0,0 +1,3 @@
+complete -c xbump -f
+complete -c xbump -a '(__xtools_complete_one_package)'
+complete -c xbump -w 'git commit'
diff --git a/fish/completions/xchangelog.fish b/fish/completions/xchangelog.fish
new file mode 100644
index 0000000..d1ae999
--- /dev/null
+++ b/fish/completions/xchangelog.fish
@@ -0,0 +1,2 @@
+complete -c xchangelog -f
+complete -c xchangelog -a '(__xtools_complete_one_package)'
diff --git a/fish/completions/xcheckmypkgs.fish b/fish/completions/xcheckmypkgs.fish
new file mode 100644
index 0000000..64665a8
--- /dev/null
+++ b/fish/completions/xcheckmypkgs.fish
@@ -0,0 +1 @@
+complete -c xcheckmypkgs -w xmypkgs
diff --git a/fish/completions/xcheckrestart.fish b/fish/completions/xcheckrestart.fish
new file mode 100644
index 0000000..e84242b
--- /dev/null
+++ b/fish/completions/xcheckrestart.fish
@@ -0,0 +1,2 @@
+complete -c xcheckrestart -f
+complete -c xcheckrestart -s v -d 'Verbose mode'
diff --git a/fish/completions/xchroot.fish b/fish/completions/xchroot.fish
new file mode 100644
index 0000000..5bc15fb
--- /dev/null
+++ b/fish/completions/xchroot.fish
@@ -0,0 +1,2 @@
+complete -c xchroot -f
+complete -c xchroot -n '[ (count (commandline -poc)) -eq 1 ]' -a '(__fish_complete_directories)'
diff --git a/fish/completions/xclash.fish b/fish/completions/xclash.fish
new file mode 100644
index 0000000..42d5d2a
--- /dev/null
+++ b/fish/completions/xclash.fish
@@ -0,0 +1 @@
+complete -c xclash -f
diff --git a/fish/completions/xdbg.fish b/fish/completions/xdbg.fish
new file mode 100644
index 0000000..a805732
--- /dev/null
+++ b/fish/completions/xdbg.fish
@@ -0,0 +1,2 @@
+complete -c xdbg -f
+complete -c xdbg -a '(__xtools_complete_packages)'
diff --git a/fish/completions/xdiff.fish b/fish/completions/xdiff.fish
new file mode 100644
index 0000000..0976cdb
--- /dev/null
+++ b/fish/completions/xdiff.fish
@@ -0,0 +1,4 @@
+complete -c xdiff -f
+complete -c xdiff -s u -d 'Only display differences'
+complete -c xdiff -s l -d 'Only list files with differences'
+complete -c xdiff -a '(__fish_complete_directories)'
diff --git a/fish/completions/xdistdir.fish b/fish/completions/xdistdir.fish
new file mode 100644
index 0000000..09e085b
--- /dev/null
+++ b/fish/completions/xdistdir.fish
@@ -0,0 +1 @@
+complete -c xdistdir -f
diff --git a/fish/completions/xdowngrade.fish b/fish/completions/xdowngrade.fish
new file mode 100644
index 0000000..3035544
--- /dev/null
+++ b/fish/completions/xdowngrade.fish
@@ -0,0 +1,2 @@
+complete -c xdowngrade -f
+complete -c xdowngrade -ka '(__fish_complete_suffix xbps)' -d 'Package file'
diff --git a/fish/completions/xetcchanges.fish b/fish/completions/xetcchanges.fish
new file mode 100644
index 0000000..923360c
--- /dev/null
+++ b/fish/completions/xetcchanges.fish
@@ -0,0 +1 @@
+complete -c xetcchanges -f
diff --git a/fish/completions/xgensum.fish b/fish/completions/xgensum.fish
new file mode 100644
index 0000000..1cfb4e6
--- /dev/null
+++ b/fish/completions/xgensum.fish
@@ -0,0 +1,6 @@
+complete -c xgensum -f
+complete -c xgensum -s f -d 'Force (re-)download of distfiles'
+complete -c xgensum -s c -d 'Use content checksum'
+complete -c xgensum -s i -d 'Replace checksum in-place'
+complete -c xgensum -s H -d 'Absolute path to hostdir' -xa '(__fish_complete_directories)'
+complete -c xgensum -a '(__xtools_complete_one_package)'
diff --git a/fish/completions/xgrep.fish b/fish/completions/xgrep.fish
new file mode 100644
index 0000000..c7a329e
--- /dev/null
+++ b/fish/completions/xgrep.fish
@@ -0,0 +1,2 @@
+complete -c xgrep -f
+complete -c xgrep -n '[ (count (commandline -poc)) -gt 1 ]' -a '(__fish_print_xbps_packages -i)'
diff --git a/fish/completions/xhog.fish b/fish/completions/xhog.fish
new file mode 100644
index 0000000..bbfe934
--- /dev/null
+++ b/fish/completions/xhog.fish
@@ -0,0 +1 @@
+complete -c xhog -f
diff --git a/fish/completions/xi.fish b/fish/completions/xi.fish
new file mode 100644
index 0000000..f928830
--- /dev/null
+++ b/fish/completions/xi.fish
@@ -0,0 +1 @@
+complete -c xi -w xbps-install
diff --git a/fish/completions/xilog.fish b/fish/completions/xilog.fish
new file mode 100644
index 0000000..966764a
--- /dev/null
+++ b/fish/completions/xilog.fish
@@ -0,0 +1 @@
+complete -c xilog -f
diff --git a/fish/completions/xlg.fish b/fish/completions/xlg.fish
new file mode 100644
index 0000000..aa5e334
--- /dev/null
+++ b/fish/completions/xlg.fish
@@ -0,0 +1,2 @@
+complete -c xlg -f
+complete -c xlg -a '(__xtools_complete_one_package)'
diff --git a/fish/completions/xlint.fish b/fish/completions/xlint.fish
new file mode 100644
index 0000000..d6e6937
--- /dev/null
+++ b/fish/completions/xlint.fish
@@ -0,0 +1,2 @@
+complete -c xlint -f
+complete -c xlint -a '(__xtools_complete_packages)'
diff --git a/fish/completions/xlocate.fish b/fish/completions/xlocate.fish
new file mode 100644
index 0000000..df53d1c
--- /dev/null
+++ b/fish/completions/xlocate.fish
@@ -0,0 +1,11 @@
+complete -c xlocate -f
+complete -c xlocate -s h -d 'Print help message and exit'
+complete -c xlocate -s g -d 'Update xlocate.git'
+complete -c xlocate -s S -d 'Sync with official xlocate.git'
+complete -c xlocate -s E -d 'Use POSIX extended regexp for patterns'
+complete -c xlocate -s F -d 'Use fixed strings for patterns'
+complete -c xlocate -s G -d 'Use POSIX basic regexp for patterns'
+complete -c xlocate -s P -d 'Use Perl-compatible regular expressions for patterns'
+complete -c xlocate -s i -d 'Ignore case differences between the patterns and the files'
+complete -c xlocate -s w -d 'Match the pattern only at word boundary'
+complete -c xlocate -s e -d 'The next parameter is the pattern' -x
diff --git a/fish/completions/xlog.fish b/fish/completions/xlog.fish
new file mode 100644
index 0000000..d413074
--- /dev/null
+++ b/fish/completions/xlog.fish
@@ -0,0 +1,2 @@
+complete -c xlog -f
+complete -c xlog -a '(__xtools_complete_one_package)'
diff --git a/fish/completions/xls.fish b/fish/completions/xls.fish
new file mode 100644
index 0000000..d2dae6a
--- /dev/null
+++ b/fish/completions/xls.fish
@@ -0,0 +1,2 @@
+complete -c xls -f
+complete -c xls -a '(__xtools_complete_packages)'
diff --git a/fish/completions/xmandoc.fish b/fish/completions/xmandoc.fish
new file mode 100644
index 0000000..ebadfb8
--- /dev/null
+++ b/fish/completions/xmandoc.fish
@@ -0,0 +1 @@
+complete -c xmandoc -f
diff --git a/fish/completions/xmksv.fish b/fish/completions/xmksv.fish
new file mode 100644
index 0000000..d24a6b0
--- /dev/null
+++ b/fish/completions/xmksv.fish
@@ -0,0 +1,2 @@
+complete -c xmksv -f
+complete -c xmksv -s l -d 'Also create log service'
diff --git a/fish/completions/xmypkgs.fish b/fish/completions/xmypkgs.fish
new file mode 100644
index 0000000..bfb0922
--- /dev/null
+++ b/fish/completions/xmypkgs.fish
@@ -0,0 +1,2 @@
+complete -c xmypkgs -f
+complete -c xmypkgs -n '[ (count (commandline -poc)) -eq 1 ]' -a '(git -C (xdistdir) log --pretty=%ce)' -d Contributor
diff --git a/fish/completions/xnew.fish b/fish/completions/xnew.fish
new file mode 100644
index 0000000..a8c1912
--- /dev/null
+++ b/fish/completions/xnew.fish
@@ -0,0 +1,2 @@
+complete -c xnew -f
+complete -c xnew -s a -d 'Append subpackages to existing package'
diff --git a/fish/completions/xnews.fish b/fish/completions/xnews.fish
new file mode 100644
index 0000000..0584d48
--- /dev/null
+++ b/fish/completions/xnews.fish
@@ -0,0 +1 @@
+complete -c xnews -f
diff --git a/fish/completions/xnodev.fish b/fish/completions/xnodev.fish
new file mode 100644
index 0000000..1b65222
--- /dev/null
+++ b/fish/completions/xnodev.fish
@@ -0,0 +1 @@
+complete -c xnodev -f
diff --git a/fish/completions/xoptdiff.fish b/fish/completions/xoptdiff.fish
new file mode 100644
index 0000000..f2e482e
--- /dev/null
+++ b/fish/completions/xoptdiff.fish
@@ -0,0 +1,3 @@
+complete -c xoptdiff -f
+complete -c xoptdiff -s q -d 'Only list differing packages'
+complete -c xoptdiff -a '(__fish_print_xbps_packages -i)'
diff --git a/fish/completions/xpcdeps.fish b/fish/completions/xpcdeps.fish
new file mode 100644
index 0000000..4a47d91
--- /dev/null
+++ b/fish/completions/xpcdeps.fish
@@ -0,0 +1 @@
+complete -c xpcdeps -f
diff --git a/fish/completions/xpkg.fish b/fish/completions/xpkg.fish
new file mode 100644
index 0000000..bada2e5
--- /dev/null
+++ b/fish/completions/xpkg.fish
@@ -0,0 +1,11 @@
+complete -c xpkg -f
+complete -c xpkg -s r -d 'Full path for the target root directory' -xa '(__fish_complete_directories)'
+complete -c xpkg -s R -d 'Consider only packages from repository' -xa '(__fish_complete_directories)'
+complete -c xpkg -s a -d 'List all packages'
+complete -c xpkg -s m -d 'List manual packages'
+complete -c xpkg -s O -d 'List orphaned packages'
+complete -c xpkg -s H -d 'List packages on hold'
+complete -c xpkg -s D -d 'List installed packages not in repo'
+complete -c xpkg -s L -d 'List installed packages not from remote repos'
+complete -c xpkg -s v -d 'Show version numbers'
+complete -c xpkg -s V -d 'Show version numbers and descriptions'
diff --git a/fish/completions/xpkgdiff.fish b/fish/completions/xpkgdiff.fish
new file mode 100644
index 0000000..58272d8
--- /dev/null
+++ b/fish/completions/xpkgdiff.fish
@@ -0,0 +1,12 @@
+complete -c xpkgdiff -f
+complete -c xpkgdiff -s c -d 'Compare a file from package' -rF
+complete -c xpkgdiff -s S -d 'Compare package metadata'
+complete -c xpkgdiff -s f -d 'Compare package file lists'
+complete -c xpkgdiff -s r -d 'Reverse diff (compare local to remote)'
+complete -c xpkgdiff -s R -d 'Set remote repo URL' -xa '(__xtools_complete_repo_urls)'
+complete -c xpkgdiff -s x -d 'Compare package dependencies'
+complete -c xpkgdiff -s t -d 'Compare the full package dependency tree for -x'
+complete -c xpkgdiff -s a -d 'Set architecture for comparison' -xa '(__xtools_complete_archs)'
+# TODO: complete package properties
+complete -c xpkgdiff -s p -d 'Compare package properties' -x
+complete -c xpkgdiff -a '(__xtools_complete_packages)'
diff --git a/fish/completions/xpstree.fish b/fish/completions/xpstree.fish
new file mode 100644
index 0000000..1eeae6a
--- /dev/null
+++ b/fish/completions/xpstree.fish
@@ -0,0 +1 @@
+complete -c xpstree -f
diff --git a/fish/completions/xq.fish b/fish/completions/xq.fish
new file mode 100644
index 0000000..a784666
--- /dev/null
+++ b/fish/completions/xq.fish
@@ -0,0 +1,3 @@
+complete -c xq -f
+complete -c xq -s R -d 'Query remote repos'
+complete -c xq -a '(__xtools_complete_packages)'
diff --git a/fish/completions/xrecent.fish b/fish/completions/xrecent.fish
new file mode 100644
index 0000000..0b9e3c1
--- /dev/null
+++ b/fish/completions/xrecent.fish
@@ -0,0 +1,2 @@
+complete -c xrecent -f
+complete -c xrecent -n '[ (count (commandline -poc)) -eq 1 ]' -xa '(__xtools_complete_repo_urls; __xtools_complete_archs)'
diff --git a/fish/completions/xrevbump.fish b/fish/completions/xrevbump.fish
new file mode 100644
index 0000000..dfb2979
--- /dev/null
+++ b/fish/completions/xrevbump.fish
@@ -0,0 +1,11 @@
+function __xrevbump_complete_git_commit_args
+    set -l tokens (commandline -poc; commandline -ct)
+    set -l dashdash (contains -i -- -- $tokens); or return
+    set -e tokens[1..$dashdash]
+    complete --do-complete="git commit $tokens"
+end
+
+complete -c xrevbump -f
+complete -c xrevbump -n 'not contains -- -- (commandline -poc)' -n '[ (count (commandline -poc)) -gt 1 ]' -a '(__xtools_complete_packages)'
+# Complete `git commit` args after `--`
+complete -c xrevbump -a '(__xrevbump_complete_git_commit_args)'
diff --git a/fish/completions/xrevshlib.fish b/fish/completions/xrevshlib.fish
new file mode 100644
index 0000000..4a4aa59
--- /dev/null
+++ b/fish/completions/xrevshlib.fish
@@ -0,0 +1,2 @@
+complete -c xrevshlib -f
+complete -c xrevshlib -a '(__xtools_complete_one_package)'
diff --git a/fish/completions/xrs.fish b/fish/completions/xrs.fish
new file mode 100644
index 0000000..1ab7300
--- /dev/null
+++ b/fish/completions/xrs.fish
@@ -0,0 +1 @@
+complete -c xrs -f
diff --git a/fish/completions/xsrc.fish b/fish/completions/xsrc.fish
new file mode 100644
index 0000000..22e7de9
--- /dev/null
+++ b/fish/completions/xsrc.fish
@@ -0,0 +1,2 @@
+complete -c xsrc -f
+complete -c xsrc -a '(__xtools_complete_one_package)'
diff --git a/fish/completions/xsubpkg.fish b/fish/completions/xsubpkg.fish
new file mode 100644
index 0000000..d4bc281
--- /dev/null
+++ b/fish/completions/xsubpkg.fish
@@ -0,0 +1,3 @@
+complete -c xsubpkg -f
+complete -c xsubpkg -s m -d 'Only print main package'
+complete -c xsubpkg -a '(__xtools_complete_packages)'
diff --git a/fish/completions/xuname.fish b/fish/completions/xuname.fish
new file mode 100644
index 0000000..4de09fd
--- /dev/null
+++ b/fish/completions/xuname.fish
@@ -0,0 +1 @@
+complete -c xuname -f
diff --git a/fish/completions/xvoidstrap.fish b/fish/completions/xvoidstrap.fish
new file mode 100644
index 0000000..5c218fa
--- /dev/null
+++ b/fish/completions/xvoidstrap.fish
@@ -0,0 +1,3 @@
+complete -c xvoidstrap -f
+complete -c xvoidstrap -n '[ (count (commandline -poc)) -eq 1 ]' -a '(__fish_complete_directories)'
+complete -c xvoidstrap -n '[ (count (commandline -poc)) -gt 1 ]' -a '(__fish_print_xbps_packages)'
diff --git a/fish/functions/__xtools_complete_archs.fish b/fish/functions/__xtools_complete_archs.fish
new file mode 100644
index 0000000..6a1165d
--- /dev/null
+++ b/fish/functions/__xtools_complete_archs.fish
@@ -0,0 +1,3 @@
+function __xtools_complete_archs
+    printf %s\n {aarch64,armv{6,7}l,i686,x86_64}{,-musl}\tArchitecture
+end
diff --git a/fish/functions/__xtools_complete_one_package.fish b/fish/functions/__xtools_complete_one_package.fish
new file mode 100644
index 0000000..fcaec36
--- /dev/null
+++ b/fish/functions/__xtools_complete_one_package.fish
@@ -0,0 +1,4 @@
+function __xtools_complete_one_package
+    [ (count (commandline -poc)) -eq 1 ]
+    and __xtools_complete_packages
+end
diff --git a/fish/functions/__xtools_complete_packages.fish b/fish/functions/__xtools_complete_packages.fish
new file mode 100644
index 0000000..a3b53af
--- /dev/null
+++ b/fish/functions/__xtools_complete_packages.fish
@@ -0,0 +1,3 @@
+function __xtools_complete_packages
+    printf %s\n (path basename -- (xdistdir)/srcpkgs/*)\tPackage
+end
diff --git a/fish/functions/__xtools_complete_repo_urls.fish b/fish/functions/__xtools_complete_repo_urls.fish
new file mode 100644
index 0000000..052d234
--- /dev/null
+++ b/fish/functions/__xtools_complete_repo_urls.fish
@@ -0,0 +1,9 @@
+function __xtools_complete_repo_urls
+    if [ -e /usr/share/xmirror/mirrors.lst ]
+        string match -vr '^\s*#' </usr/share/xmirror/mirrors.lst | while read -l line
+            set -l values (string split \t -- $line)
+            # Mirror url, location, and tier
+            echo -- $values[2]\t$values[3], Tier $values[4]
+        end
+    end
+end