Add help for command-line ceo

pull/5/head
David Bartley 15 years ago
parent 93310af3c7
commit 0cade22049
  1. 7
      ceo/console/expiredaccounts.py
  2. 8
      ceo/console/inactive.py
  3. 23
      ceo/console/main.py
  4. 12
      ceo/console/memberlist.py
  5. 5
      ceo/console/updateprograms.py

@ -2,6 +2,13 @@ import ldap
from ceo import members, uwldap
class ExpiredAccounts:
help = '''
expiredaccounts [--email]
Displays a list of expired accounts. If --email is specified, expired account
owners will be emailed. The email will go to the email listed in uwdir.
'''
def main(self, args):
send_email = False
if len(args) == 1 and args[0] == '--email':

@ -7,9 +7,15 @@ def max_term(term1, term2):
return term2
class Inactive:
help = '''
inactive delta-terms
Prints a list of accounts that have been inactive (i.e. not unpaid) for
delta-terms.
'''
def main(self, args):
if len(args) != 1:
print "Usage: ceo inactive delta-terms"
print self.help
return
delta = int(args[0])
mlist = members.list_all()

@ -24,11 +24,26 @@ def start():
(opts, args) = getopt(sys.argv[1:], shortopts, longopts)
if len(args) >= 1:
if args[0] in commands:
commands[args[0]].main(args[1:])
command = commands[args[0]]
if len(args) >= 2 and args[1] in ['--help', '-h']:
print command.help
else:
command.main(args[1:])
else:
print "Invalid command '%s'" % args[0]
def help():
print 'Available commands:'
for c in commands:
print ' %s' % c
args = sys.argv[2:]
if len(args) == 1:
if args[0] in commands:
print commands[args[0]].help
else:
print 'Unknown command %s.' % args[0]
else:
print ''
print 'Available commands:'
for c in commands:
print ' %s' % c
print ''
print 'Run \'ceo command --help\' for help on a specific command.'
print ''

@ -1,8 +1,18 @@
from ceo import members, terms
class MemberList:
help = '''
memberlist [term]
Displays a list of members for a term; defaults to the current term if term
is not given.
'''
def main(self, args):
mlist = members.list_term(terms.current())
mlist = {}
if len(args) == 1:
mlist = members.list_term(args[0])
else:
mlist = members.list_term(terms.current())
dns = mlist.keys()
dns.sort()
for dn in dns:

@ -2,6 +2,11 @@ import ldap, sys, termios
from ceo import members, uwldap, ldapi
class UpdatePrograms:
help = '''
updateprograms
Interactively updates the program field for an account by querying uwdir.
'''
def main(self, args):
mlist = members.list_all().items()
uwl = ldap.initialize(uwldap.uri())

Loading…
Cancel
Save