]> git.decadent.org.uk Git - dak.git/blobdiff - helena
* katie.py (source_exists): expand the list of distributionsthe source may exist...
[dak.git] / helena
diff --git a/helena b/helena
index 18cfbc39cf1934be71817a0aed4927b305a029db..7337461013320e5e370a2169ea7735be131111f4 100755 (executable)
--- a/helena
+++ b/helena
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 
 # Produces a report on NEW and BYHAND packages
-# Copyright (C) 2001, 2002  James Troup <james@nocrew.org>
-# $Id: helena,v 1.3 2002-12-08 17:25:47 troup Exp $
+# Copyright (C) 2001, 2002, 2003  James Troup <james@nocrew.org>
+# $Id: helena,v 1.5 2003-07-15 17:29:26 troup Exp $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -44,7 +44,16 @@ Katie = None;
 
 ################################################################################
 
-def plural (x):
+def usage(exit_code=0):
+    print """Usage: helena
+Prints a report of packages in queue directories (usually new and byhand).
+
+  -h, --help                show this help and exit."""
+    sys.exit(exit_code)
+
+################################################################################
+
+def plural(x):
     if x > 1:
         return "s";
     else:
@@ -72,7 +81,7 @@ def time_pp(x):
         unit="month";
     else:
         x /= 29030400;
-        unit="years";
+        unit="year";
     x = int(x);
     return "%s %s%s" % (x, unit, plural(x));
 
@@ -189,12 +198,22 @@ def main():
     global Cnf, Katie;
 
     Cnf = utils.get_conf();
-    apt_pkg.ParseCommandLine(Cnf,[],sys.argv);
+    Arguments = [('h',"help","Helena::Options::Help")];
+    for i in [ "help" ]:
+       if not Cnf.has_key("Helena::Options::%s" % (i)):
+           Cnf["Helena::Options::%s" % (i)] = "";
+
+    apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv);
+
+    Options = Cnf.SubTree("Helena::Options")
+    if Options["Help"]:
+       usage();
+
     Katie = katie.Katie(Cnf);
 
     directories = Cnf.ValueList("Helena::Directories");
     if not directories:
-        directories = [ "byhand", "new"]
+        directories = [ "byhand", "new" ];
 
     for directory in directories:
         changes_files = glob.glob("%s/*.changes" % (Cnf["Dir::Queue::%s" % (directory)]));