about summary refs log tree commit diff
diff options
context:
space:
mode:
authorÉrico Rolim <erico.erc@gmail.com>2020-07-23 20:46:41 -0300
committerLeah Neukirchen <leah@vuxu.org>2020-07-25 18:15:33 +0200
commit8f1f1fee5e85361f7400e535d83dfd2c2d229d4d (patch)
treea88b5f7fb13fcc6481881dceb7ce7cc34e9e9485
parent14acc532dc288c1d63e2199dabbb23b40a5f81bc (diff)
downloadxtools-8f1f1fee5e85361f7400e535d83dfd2c2d229d4d.tar.gz
xtools-8f1f1fee5e85361f7400e535d83dfd2c2d229d4d.tar.xz
xtools-8f1f1fee5e85361f7400e535d83dfd2c2d229d4d.zip
xlint: accept pkgname as well as path to template. v0.60
Makes it possible to call xlint as: `xlint 0ad`.
-rwxr-xr-xxlint15
-rw-r--r--xtools.12
2 files changed, 13 insertions, 4 deletions
diff --git a/xlint b/xlint
index af910ba..788976e 100755
--- a/xlint
+++ b/xlint
@@ -247,9 +247,18 @@ wrksrc
 xml_catalogs
 xml_entries" | tr '\n' '|')
 
+void_packages="$(xdistdir)/"
 ret=0
-for template; do
-	if [ -f "$template" ]; then
+for argument; do
+	template=
+	if [ -f "$argument" ]; then
+		template="$argument"
+	else
+		_template="${void_packages}srcpkgs/$argument/template"
+		[ -f "$_template" ] && template="$_template"
+	fi
+
+	if [ "$template" ]; then
 	exists_once "$template"
 	scan 'short_desc=.*\."' "unwanted trailing dot in short_desc"
 	scan 'short_desc=["'\''][a-z]' "short_desc should start uppercase"
@@ -336,7 +345,7 @@ for template; do
 	header
 	file_end
 	else
-	echo no such template "$template" 1>&2
+	echo no such template "$argument" 1>&2
 	fi | sort -t: -n -k2 | grep . && ret=1
 done
 exit $ret
diff --git a/xtools.1 b/xtools.1
index 5c3e68a..6feb9a8 100644
--- a/xtools.1
+++ b/xtools.1
@@ -73,7 +73,7 @@ but take cwd repo and sudo/su into account
 .Nd list installed packages by install-date
 .It Nm xlg Ar pkg
 .Nd open short commit log for XBPS template
-.It Nm xlint Ar template
+.It Nm xlint Ar template | pkgname
 .Nd scan XBPS template for common mistakes
 .It Nm xlocate
 .Oo