Package: d-i/scripts/doc-check
Version: svn
Author: Guillem Jover <guillem@hadrons.org>
Status: applied
Description:
 Add a help option with usage output.


Index: scripts/doc-check
===================================================================
--- scripts/doc-check	(revision 41067)
+++ scripts/doc-check	(working copy)
@@ -1,23 +1,12 @@
 #!/usr/bin/perl -w
-
+#
 # This script checks if the translations of the documents are up to date.
-# When called with "-d" option, it also prints what has changed in the
-# original since last translation.
-# If the "-r" option is used with the "-d" option, the diff will be taken
-# against the revision number specified with the -r option instead of
-# the latest revision of the English original.
-# When called with "-s" option, it also shows all files that are marked
-# untranslated.
-
-# SYNOPSIS:
-#             ./doc-check [-d] [-r <revision>] [-s] [-v] [-V] [lang]
 #
-#	(uses $lang set below if lang is not given on commandline)
 
 use Getopt::Std;
 use File::Find;
-$opt_d = $opt_r = $opt_s = $opt_v = $opt_V = 0;
-getopts('r:dsvV');
+$opt_d = $opt_h = $opt_r = $opt_s = $opt_v = $opt_V = 0;
+getopts('hr:dsvV');
 # You may set this to your default language code
 $lang = shift || "pl";
 if ($opt_r and $opt_r !~ /[0-9]+/) {
@@ -25,6 +14,28 @@
 	exit 1
 }
 
+sub usage
+{
+	printf <<HERE, $lang;
+Usage: $0 [options] [<lang>]
+
+  -h        print this help message
+  -d        print what has changed in the original since last translation.
+  -r <rev>  take the diff against the revision number <rev> instead of the
+            latest revision of the English original.
+  -s        show also all files marked untranslated.
+  -v        be verbose.
+  -V        be slightly more verbose.
+
+  By default <lang> is '%s'.
+HERE
+  exit 0;
+}
+
+if ($opt_h) {
+  usage()
+}
+
 sub checkdiff
 {
 	my ($plfname, $enfname) = (@_);
