diff options
author | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2011-12-31 19:54:14 -0200 |
---|---|---|
committer | Rodolfo Carvalho <rhcarvalho@gmail.com> | 2011-12-31 19:54:14 -0200 |
commit | cbc6a0296bfdb44a09932d30cfb3aade8f23e156 (patch) | |
tree | 008bff8f13f235a857e024e17f20d89c9e3e1c35 /examples | |
parent | cc63bef17988e219ee2b57e845fe6fbc033c110f (diff) | |
download | slixmpp-cbc6a0296bfdb44a09932d30cfb3aade8f23e156.tar.gz slixmpp-cbc6a0296bfdb44a09932d30cfb3aade8f23e156.tar.bz2 slixmpp-cbc6a0296bfdb44a09932d30cfb3aade8f23e156.tar.xz slixmpp-cbc6a0296bfdb44a09932d30cfb3aade8f23e156.zip |
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.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/muc.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/muc.py b/examples/muc.py index ed54387a..7586c61c 100755 --- a/examples/muc.py +++ b/examples/muc.py @@ -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 |