Simplify help
This commit is contained in:
parent
8e4f11b47b
commit
85d38fc879
|
@ -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,19 +12,15 @@ 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:
|
||||
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', '-h']:
|
||||
if len(args) >= 2 and args[1] in help_opts:
|
||||
print command.help
|
||||
else:
|
||||
command.main(args[1:])
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue