Changed to be entirely interactive.

This commit is contained in:
Jeremy Fincher 2003-04-06 11:40:01 +00:00
parent 99364a27af
commit 01b9ae732c

View File

@ -56,11 +56,9 @@ Class = %s
'''.strip() # This removes the newlines that precede and follow the text. '''.strip() # This removes the newlines that precede and follow the text.
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) < 2: name = anything('What should the name of the plugin be?')
print 'Usage: %s <plugin name>' % sys.argv[0] if name.endswith('.py'):
sys.exit(-1) name = name[:-3]
name = sys.argv[1]
if expect('Do you want a command-based plugin' \ if expect('Do you want a command-based plugin' \
' or a regexp-based plugin?', ' or a regexp-based plugin?',
['command', 'regexp']) == 'command': ['command', 'regexp']) == 'command':
@ -75,5 +73,6 @@ if __name__ == '__main__':
fd = file(os.path.join('plugins', name + '.py'), 'w') fd = file(os.path.join('plugins', name + '.py'), 'w')
fd.write(template % (name, className, threaded, name)) fd.write(template % (name, className, threaded, name))
fd.close() fd.close()
print 'Your new plugin template is in plugins/%s.py' % name
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: