-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

On Thu, 9 Jul 2015 17:51:02 +0000 Mattia Rizzolo <mat...@mapreri.org>
wrote:
> There is not something like "coding standards" for devscripts, it's
> bore out of random scripts collected into a package. Expecially for
> a script like wnpp-check...
> 
> Would you also add something to the --help and the manpage?
> 
> I suggest also you to clone the devscripts git repository to easy
> diff your patches (`git diff`, `git format-patch`,...)

I've added the necessary information to the manpage and usage() method
in the script. See the attached patch.

PS : It was generated using git format-patch. Hope that was what you
suggested. :)

- -- 
Regards
Balasankar C
http://balasankarc.in
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCgAGBQJVn/SaAAoJEJbtq5sua3FxmAcIAKnTCCIAQHPs6yH9YQJYOApo
av/POeCqZ56AqitPh2GaSYq4F2x3Osn/sZqCm6uAXgh+QNqACRuEOnzQeSG9My3p
WmNCOJUgO61fDlAPbUa0kEOrs+t5Co4o2Ag2idwgz0qgTlyflkR7t2Gw8vpbklTE
9OCoPiVAu7k4k7spw3c9gon4ZUvz/DQCp998IHrwi5ss5PL20wr3ZHG2LrvfeY5h
JKijaV9H5LTLB3JON4iW23N2ikHfqnUBIAe0gq1XVsTi/iGJfIKWHRSc67MkzAqQ
tF4vyR75BuF1ckcXnUkniDqj430PvWedTyH2EAaUwjOdlA5KfcA/c4WjFlAMoFQ=
=wLo2
-----END PGP SIGNATURE-----
From 2ff993d7ec68bfe25b7a6d86aea51e48083023f5 Mon Sep 17 00:00:00 2001
From: Balasankar C <balasank...@autistici.org>
Date: Fri, 10 Jul 2015 21:07:22 +0530
Subject: [PATCH] Add exact-name-query option to wnpp-check

---
 scripts/wnpp-check.1  |  5 ++++-
 scripts/wnpp-check.sh | 18 +++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/scripts/wnpp-check.1 b/scripts/wnpp-check.1
index c04f61b..0b904f7 100644
--- a/scripts/wnpp-check.1
+++ b/scripts/wnpp-check.1
@@ -2,7 +2,7 @@
 .SH NAME
 wnpp-check \- check if a package is being packaged or if this has been requested
 .SH SYNOPSIS
-\fBwnpp-check \fIpackage \fR...
+\fBwnpp-check\fR [\fIOPTIONS\fR] \fIpackage \fR...
 .br
 \fBwnpp-check \-\-help\fR|\fB\-\-version\fR
 .SH DESCRIPTION
@@ -15,6 +15,9 @@ Note that WNPP, and therefore \fBwnpp-check\fR's output, is source
 package based.
 .SH OPTIONS
 .TP
+.BR \-\-exact ", " \-e
+Query for exact match in package name
+.TP
 .BR \-\-help ", " \-h
 Show a summary of options.
 .TP
diff --git a/scripts/wnpp-check.sh b/scripts/wnpp-check.sh
index 02a7186..97b018d 100755
--- a/scripts/wnpp-check.sh
+++ b/scripts/wnpp-check.sh
@@ -10,12 +10,20 @@
 
 set -e
 
-PACKAGES="$@"
 CURLORWGET=""
 GETCOMMAND=""
 
+if [ "x$1" = "x--exact" -o "x$1" = "x-e" ]; then
+    shift
+    PACKAGES="$@"
+    EXACT=1
+else
+    PACKAGES="$@"
+    EXACT=0
+fi
 usage () { echo \
-"Usage: ${0##*/} <package name> [...]
+"Usage: ${0##*/} [option] <package name> [...]
+  -e,--exact         Query for exact match in package name
   -h,--help          Show this help message
   -v,--version       Show a version message
 
@@ -72,7 +80,11 @@ awk -F' ' '{print "("$1" - #"$2") http://bugs.debian.org/"$2"; "$3}' $WNPP | sort
 FOUND=0
 for pkg in $PACKAGES
 do
-    grep $pkg $WNPP_PACKAGES && FOUND=1
+    if [ $EXACT = 1 ]; then
+        grep " $pkg$" $WNPP_PACKAGES && FOUND=1
+    else
+        grep $pkg $WNPP_PACKAGES && FOUND=1
+    fi
 done
 
 exit $FOUND
-- 
2.1.4

Attachment: 0x2E6B7171.asc
Description: application/pgp-keys

Reply via email to