X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=helena;h=7337461013320e5e370a2169ea7735be131111f4;hb=6cc79b7b093af0c68c9d80c61d5aa7cfe72c9188;hp=18cfbc39cf1934be71817a0aed4927b305a029db;hpb=2f026ef5089a8a52faf135286b3f152f6bcd0a64;p=dak.git diff --git a/helena b/helena index 18cfbc39..73374610 100755 --- 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 -# $Id: helena,v 1.3 2002-12-08 17:25:47 troup Exp $ +# Copyright (C) 2001, 2002, 2003 James Troup +# $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)]));