From 3cda6f4f6b92f18d2bd23de77a5b53030d7d150c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 22 Feb 2007 08:06:54 +0000 Subject: * Rewrote pactest with an OptionParser so we can have helpful help text, and bumped the version to 0.4. Still a work in progress. * Changed some linewraps in rankmirrors to keep everything under 80 chars. --- scripts/rankmirrors | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/rankmirrors b/scripts/rankmirrors index 90bcad87..5bec6498 100644 --- a/scripts/rankmirrors +++ b/scripts/rankmirrors @@ -25,16 +25,19 @@ from optparse import OptionParser def createOptParser(): usage = "usage: %prog [options] MIRRORFILE | URL" - description = "Ranks pacman mirrors by their connection and opening speed. Pacman mirror files are located in /etc/pacman.d/. It can also rank one mirror if the URL is provided." - parser = OptionParser(usage=usage,description=description) - parser.add_option("-f", "--formatted", action="store_true", - dest = "formatted", default=False, help="output in mirror file format") - parser.add_option("-n", dest="num", default=0, - help="number of servers to output, 0 for all") - parser.add_option("-u", "--url", action="store_true", dest="url", + description = "Ranks pacman mirrors by their connection and opening " \ + "speed. Pacman mirror files are located in /etc/pacman.d/. It " \ + "can also rank one mirror if the URL is provided." + parser = OptionParser(usage = usage, description = description) + parser.add_option("-f", "--formatted", action = "store_true", + dest = "formatted", default = False, + help = "output in mirror file format") + parser.add_option("-n", type = "int", dest = "num", default = 0, + help = "number of servers to output, 0 for all") + parser.add_option("-u", "--url", action = "store_true", dest = "url", default=False, help="test a specific url") - parser.add_option("-v", "--verbose", action="store_true", dest="verbose", - default=False, help="be verbose in output") + parser.add_option("-v", "--verbose", action = "store_true", + dest = "verbose", default = False, help ="be verbose in output") return parser def timeCmd(cmd): @@ -86,7 +89,8 @@ if __name__ == "__main__": fl = open(args[0], 'r') serverToTime = {} if options.formatted: - print "# Server list generated by rankmirrors on", datetime.date.today() + print "# Server list generated by rankmirrors on", + print datetime.date.today() else: print 'Querying servers, this may take some time...' for ln in fl.readlines(): -- cgit v1.2.3-70-g09d2