+#---------- implementations of actual operation modes ----------
+
+def do_pirate(pirates, bu):
+ print '{'
+ for pirate in pirates:
+ info = PirateInfo(pirate)
+ print '%s: %s,' % (`pirate`, info)
+ print '}'
+
+def prep_crew_of(args, bu, max_age=300):
+ if len(args) != 1: bu('crew-of takes one pirate name')
+ pi = PirateInfo(args[0], max_age)
+ if pi.crew is None: return None
+ return CrewInfo(pi.crew[0], max_age)
+
+def do_crew_of(args, bu):
+ ci = prep_crew_of(args, bu)
+ print ci
+
+def do_standings_crew_of(args, bu):
+ ci = prep_crew_of(args, bu, 60)
+ tab = StandingsTable()
+ tab.headings()
+ for (rank, members) in ci.crew:
+ if not members: continue
+ tab.literalline('%s:' % rank)
+ for p in members:
+ pi = PirateInfo(p, random.randint(900,1800))
+ tab.pirate(pi)
+ print tab.results()
+