Simplify help
This commit is contained in:
parent
8e4f11b47b
commit
85d38fc879
|
@ -1,5 +1,4 @@
|
||||||
import sys, ldap, termios
|
import sys, ldap, termios
|
||||||
from getopt import getopt
|
|
||||||
from ceo import members, terms, uwldap, ldapi
|
from ceo import members, terms, uwldap, ldapi
|
||||||
|
|
||||||
from ceo.console.memberlist import MemberList
|
from ceo.console.memberlist import MemberList
|
||||||
|
@ -13,19 +12,15 @@ commands = {
|
||||||
'expiredaccounts' : ExpiredAccounts(),
|
'expiredaccounts' : ExpiredAccounts(),
|
||||||
'inactive': Inactive(),
|
'inactive': Inactive(),
|
||||||
}
|
}
|
||||||
|
help_opts = [ '--help', '-h' ]
|
||||||
shortopts = [
|
|
||||||
]
|
|
||||||
|
|
||||||
longopts = [
|
|
||||||
]
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
(opts, args) = getopt(sys.argv[1:], shortopts, longopts)
|
args = sys.argv[1:]
|
||||||
if len(args) >= 1:
|
if args[0] in help_opts:
|
||||||
if args[0] in commands:
|
help()
|
||||||
|
elif args[0] in commands:
|
||||||
command = commands[args[0]]
|
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
|
print command.help
|
||||||
else:
|
else:
|
||||||
command.main(args[1:])
|
command.main(args[1:])
|
||||||
|
|
|
@ -6,10 +6,6 @@ from ceo import ldapi, members
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
try:
|
try:
|
||||||
if len(sys.argv) >= 2 and sys.argv[1] == '--help':
|
|
||||||
ceo.console.main.help()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
members.connect(AuthCallback())
|
members.connect(AuthCallback())
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
|
|
Loading…
Reference in New Issue