mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-23 19:19:53 +00:00
Ask interactively for missing command line arguments.
Instead of complaining that the arguments were not given, ask interactively for input. This example was the only one to behave differently from the others.
This commit is contained in:
parent
cc63bef179
commit
cbc6a0296b
1 changed files with 9 additions and 3 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
import sys
|
||||
import logging
|
||||
import getpass
|
||||
from optparse import OptionParser
|
||||
|
||||
import sleekxmpp
|
||||
|
@ -160,9 +161,14 @@ if __name__ == '__main__':
|
|||
logging.basicConfig(level=opts.loglevel,
|
||||
format='%(levelname)-8s %(message)s')
|
||||
|
||||
if None in [opts.jid, opts.password, opts.room, opts.nick]:
|
||||
optp.print_help()
|
||||
sys.exit(1)
|
||||
if opts.jid is None:
|
||||
opts.jid = raw_input("Username: ")
|
||||
if opts.password is None:
|
||||
opts.password = getpass.getpass("Password: ")
|
||||
if opts.room is None:
|
||||
opts.room = raw_input("MUC room: ")
|
||||
if opts.nick is None:
|
||||
opts.nick = raw_input("MUC nickname: ")
|
||||
|
||||
# Setup the MUCBot and register plugins. Note that while plugins may
|
||||
# have interdependencies, the order in which you register them does
|
||||
|
|
Loading…
Reference in a new issue