diff --git a/ceo/console/main.py b/ceo/console/main.py index 1156f53..c32b219 100644 --- a/ceo/console/main.py +++ b/ceo/console/main.py @@ -1,5 +1,4 @@ import sys, ldap, termios -from getopt import getopt from ceo import members, terms, uwldap, ldapi from ceo.console.memberlist import MemberList @@ -13,24 +12,20 @@ commands = { 'expiredaccounts' : ExpiredAccounts(), 'inactive': Inactive(), } - -shortopts = [ -] - -longopts = [ -] +help_opts = [ '--help', '-h' ] def start(): - (opts, args) = getopt(sys.argv[1:], shortopts, longopts) - if len(args) >= 1: - if args[0] in commands: - command = commands[args[0]] - if len(args) >= 2 and args[1] in ['--help', '-h']: - print command.help - else: - command.main(args[1:]) + args = sys.argv[1:] + if args[0] in help_opts: + help() + elif args[0] in commands: + command = commands[args[0]] + if len(args) >= 2 and args[1] in help_opts: + print command.help else: - print "Invalid command '%s'" % args[0] + command.main(args[1:]) + else: + print "Invalid command '%s'" % args[0] def help(): args = sys.argv[2:] diff --git a/ceo/main.py b/ceo/main.py index 9830e18..1b81a8f 100644 --- a/ceo/main.py +++ b/ceo/main.py @@ -6,10 +6,6 @@ from ceo import ldapi, members def start(): try: - if len(sys.argv) >= 2 and sys.argv[1] == '--help': - ceo.console.main.help() - sys.exit(0) - members.connect(AuthCallback()) if len(sys.argv) == 1: