Merge pull request #942 from GLolol/scripts/saner-create-1

supybot-plugin-create: use options.desc to fill in more fields, saner defaults
This commit is contained in:
Valentin Lorentz 2014-12-11 09:37:07 +01:00
commit 55652cb417

View File

@ -104,8 +104,7 @@ except ImportError:
_ = lambda x:x _ = lambda x:x
class %s(callbacks.Plugin): class %s(callbacks.Plugin):
"""Add the help for "@plugin help %s" here """%s"""
This should describe *how* to use this plugin."""
%s %s
@ -158,7 +157,7 @@ import supybot
import supybot.world as world import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword # Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you\'re keeping the plugin in CVS or some similar system. # in here if you're keeping the plugin in CVS or some similar system.
__version__ = "" __version__ = ""
# XXX Replace this with an appropriate author or supybot.Author instance. # XXX Replace this with an appropriate author or supybot.Author instance.
@ -174,11 +173,11 @@ __url__ = ''
from . import config from . import config
from . import plugin from . import plugin
from imp import reload from imp import reload
# In case we\'re being reloaded. # In case we're being reloaded.
reload(config) reload(config)
reload(plugin) reload(plugin)
# Add more reloads here if you add third-party modules and want them to be # Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don\'t forget to import them as well! # reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing: if world.testing:
from . import test from . import test
@ -204,9 +203,6 @@ class %sTestCase(PluginTestCase):
readmeTemplate = ''' readmeTemplate = '''
%s %s
Insert a more detailed description of your plugin here, with any notes, etc. about
using it.
'''.lstrip() '''.lstrip()
def main(): def main():
@ -264,7 +260,7 @@ def main():
if not options.desc: if not options.desc:
options.desc = something(textwrap.dedent(""" options.desc = something(textwrap.dedent("""
Please provide a short description of the plugin. Please provide a short description of the plugin:
""").strip()) """).strip())
if threaded: if threaded:
@ -274,7 +270,7 @@ def main():
if name.endswith('.py'): if name.endswith('.py'):
name = name[:-3] name = name[:-3]
while name[0].islower(): while name[0].islower():
print('Plugin names must begin with a capital.') print('Plugin names must begin with a capital letter.')
name = something('What should the name of the plugin be?') name = something('What should the name of the plugin be?')
if name.endswith('.py'): if name.endswith('.py'):
name = name[:-3] name = name[:-3]
@ -292,7 +288,7 @@ def main():
fd.close() fd.close()
writeFile('plugin.py', pluginTemplate % (copyright, name, name, writeFile('plugin.py', pluginTemplate % (copyright, name, name,
name, threaded, name)) options.desc, threaded, name))
writeFile('config.py', configTemplate % (copyright, name, name, name, name, writeFile('config.py', configTemplate % (copyright, name, name, name, name,
name)) name))
writeFile('__init__.py', __init__Template % (copyright, name, options.desc)) writeFile('__init__.py', __init__Template % (copyright, name, options.desc))