about summary refs log tree commit diff
diff options
context:
space:
mode:
authorToyam Cox <Vaelatern@gmail.com>2016-03-21 23:49:14 -0400
committerChristian Neukirchen <chneukirchen@gmail.com>2016-03-22 15:00:48 +0100
commit82a4415efdd8f3536885782ffe2b8e3378a04a63 (patch)
treef267fef67ab9876422a62f9a1a460e985084c7df
parent4deb083dedd36cd91009267a8607256af6ccbe69 (diff)
downloadxtools-82a4415efdd8f3536885782ffe2b8e3378a04a63.tar.gz
xtools-82a4415efdd8f3536885782ffe2b8e3378a04a63.tar.xz
xtools-82a4415efdd8f3536885782ffe2b8e3378a04a63.zip
xsubpkg: add flag to only show main package
Closes: #37 [via git-merge-pr]
-rw-r--r--README2
-rw-r--r--_xtools8
-rwxr-xr-xxsubpkg10
3 files changed, 16 insertions, 4 deletions
diff --git a/README b/README
index 2cf328a..9d36263 100644
--- a/README
+++ b/README
@@ -36,7 +36,7 @@ https://github.com/voidlinux/xbps
   xrevbump MESSAGE TEMPLATES... - increase template revision and commit
   xrs PATTERN - like xbps-query -Rs, but take cwd repo into account
   xsrc PKG - list source files for XBPS template
-  xsubpkg PKG - lists all subpackages of a package
+  xsubpkg [-m] PKG - lists all subpackages of a package
 
 Tools working on the void-packages tree use xdistdir to find it,
 check its output is reasonable first.
diff --git a/_xtools b/_xtools
index 043a4fe..4c04c58 100644
--- a/_xtools
+++ b/_xtools
@@ -110,6 +110,12 @@ _xrevbump() {
 		':available templates:_xtools_all_packages'
 }
 
+_xsubpkg() {
+	_arguments : \
+		'-m[list master package]'\
+		'*:package:_xbps_all_packages'
+}
+
 _xtools() {
 	case "$service" in
 		xbulk) _xbulk "$@";;
@@ -134,7 +140,7 @@ _xtools() {
 		xrecent) _xrecent "$@";;
 		xrevbump) _xrevbump "$@";;
 		xsrc) _xtool_one_template "$@";;
-		xsubpkg) _xtool_one_template "$@";;
+		xsubpkg) _xsubpkg "$@";;
 	esac
 }
 
diff --git a/xsubpkg b/xsubpkg
index 1cb9066..ce236cf 100755
--- a/xsubpkg
+++ b/xsubpkg
@@ -1,6 +1,12 @@
 #!/bin/sh
-# xsubpkg PKG - lists all subpackages of a package
+# xsubpkg [-m] PKG - lists all subpackages of a package
+
+followsym="-L"
+
+case "$1" in
+	-m) followsym="-P"; shift
+esac
 
 PKG=$1
 cd $(xdistdir)
-find -L srcpkgs -maxdepth 2 -samefile srcpkgs/"$PKG"/template | cut -d/ -f 2
+find $followsym srcpkgs -maxdepth 2 -samefile srcpkgs/"$PKG"/template | cut -d/ -f 2