Author: poeml Date: 2009-03-07 06:50:54 -0700 (Sat, 07 Mar 2009) New Revision: 6738 Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py Log: mb list: - add new options to display further selected info about mirrors: --country --region --prefix --as --prio The --country conflicts a little with the previous -c|--country option to select mirrors; the latter is -c now, which is a little dumb. Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py =================================================================== --- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py 2009-03-07 07:34:37 UTC (rev 6737) +++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py 2009-03-07 13:50:54 UTC (rev 6738) _at_@ -181,15 +181,23 @@ print s - #_at_cmdln.option('-s', '--show-score', action='store_true', - # help='show score of each mirror') + _at_cmdln.option('--country', action='store_true', + help='also display the country') + _at_cmdln.option('--region', action='store_true', + help='also display the region') + _at_cmdln.option('--prefix', action='store_true', + help='also display the network prefix') + _at_cmdln.option('--as', action='store_true', + help='also display the AS') + _at_cmdln.option('--prio', action='store_true', + help='also display priorities') _at_cmdln.option('--disabled', action='store_true', help='show only disabled mirrors') _at_cmdln.option('-a', '--show-disabled', action='store_true', help='do not hide disabled mirrors') - _at_cmdln.option('-c', '--country', metavar='XY', + _at_cmdln.option('-c', metavar='XY', help='show only mirrors whose country matches XY') - _at_cmdln.option('-r', '--region', metavar='XY', + _at_cmdln.option('-r', metavar='XY', help='show only mirrors whose region matches XY ' '(possible values: sa,na,oc,af,as,eu)') # _at_cmdln.alias('ls') ? _at_@ -200,9 +208,9 @@ mirrordoctor list [IDENTIFIER] ${cmd_option_list} """ - if opts.country: + if opts.c: mirrors = self.conn.Server.select("""country LIKE '%%%s%%'""" % opts.country) - elif opts.region: + elif opts.r: mirrors = self.conn.Server.select("""region LIKE '%%%s%%'""" % opts.region) elif args: mirrors = mb.conn.servers_match(self.conn.Server, args[0]) _at_@ -210,14 +218,28 @@ mirrors = self.conn.Server.select() for mirror in mirrors: + s = [] + s.append('%-30s' % mirror.identifier) + if opts.prio: + s.append('%3s' % mirror.score) + if opts.region: + s.append('%2s' % mirror.region) + if opts.country: + s.append('%2s' % mirror.country) + if opts.as: + s.append('%5s' % mirror.asn) + if opts.prefix: + s.append('%-19s' % mirror.prefix) + s = ' '.join(s) + if opts.show_disabled: - print mirror.identifier #, mirror.score + print s elif opts.disabled: if not mirror.enabled: - print mirror.identifier #, mirror.score + print s else: if mirror.enabled: - print mirror.identifier #, mirror.score + print s def do_show(self, subcmd, opts, identifier): _______________________________________________ Opensuse-svn mailing list Opensuse-svn_at_forge.novell.com http://forge.novell.com/mailman/listinfo/opensuse-svn _______________________________________________ mirrorbrain-commits mailing list Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Sat Mar 07 2009 - 13:51:30 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT