Subject: teach wtf(6) about pkgsrc's help facility
To: None <tech-userlevel@NetBSD.org>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-userlevel
Date: 07/27/2007 17:56:56
Someone threw some coarse answer to a pkgsrc question to my head today, 
and I wondered "WTF can't wtf(6) translate for me". The patch attached 
below does just that, by running "make help topic=...:

 	% cd /usr/pkgsrc/audio/qsynth
 	% wtf subst
 	subst: ===> mk/subst.mk:
 	# This Makefile fragment implements a general text replacement facility.
 	...

Am I the only one finding this useful, or shall I commit it?
Any other comments?


  - Hubert


Index: wtf
===================================================================
RCS file: /cvsroot/src/games/wtf/wtf,v
retrieving revision 1.14
diff -u -r1.14 wtf
--- wtf	24 Jan 2007 13:17:42 -0000	1.14
+++ wtf	27 Jul 2007 15:53:46 -0000
@@ -77,6 +77,15 @@
  		shift ; continue
  	fi

+	# Try querying pkgsrc's help facility next
+	if [ -f ../../mk/bsd.pkg.mk ] ; then
+		ans=`make help topic="$1"`
+		if [ $? -eq 0 ] ; then
+			echo "$1: $ans"
+			shift ; continue
+		fi
+	fi
+
  	# Give up!
  	echo "$PROGNAME: I don't know what $1 means!" 1>&2
  	rv=1
Index: wtf.6
===================================================================
RCS file: /cvsroot/src/games/wtf/wtf.6,v
retrieving revision 1.11
diff -u -r1.11 wtf.6
--- wtf.6	17 Jun 2006 04:58:14 -0000	1.11
+++ wtf.6	27 Jul 2007 15:53:46 -0000
@@ -2,7 +2,7 @@
  .\"
  .\" Public Domain
  .\"
-.Dd June 22, 2005
+.Dd July 27, 2007
  .Dt WTF 6
  .Os
  .Sh NAME
@@ -21,10 +21,11 @@
  If the acronym is not in any of the acronyms databases,
  .Nm
  will check to see if the acronym is known by the
-.Xr whatis 1
-or the
+.Xr whatis 1 ,
+the
  .Xr pkg_info 1
-commands.
+commands, or via pkgsrc's internal help mechanism,
+.Dq make help topic=XXX .
  .Pp
  If
  .Dq is
@@ -58,6 +59,7 @@
  computer-related acronym database.
  .El
  .Sh SEE ALSO
+.Xr make 1 ,
  .Xr pkg_info 1 ,
  .Xr whatis 1
  .Sh HISTORY