From 8f1f1fee5e85361f7400e535d83dfd2c2d229d4d Mon Sep 17 00:00:00 2001 From: Érico Rolim Date: Thu, 23 Jul 2020 20:46:41 -0300 Subject: xlint: accept pkgname as well as path to template. Makes it possible to call xlint as: `xlint 0ad`. --- xlint | 15 ++++++++++++--- xtools.1 | 2 +- 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 -- cgit 1.4.1