Merge pull request #928 from joulez/scripts

supybot-plugin-create add --desc option
This commit is contained in:
Valentin Lorentz 2014-12-03 08:14:58 +01:00
commit 1e8d51ac6d

View File

@ -151,8 +151,7 @@ __init__Template = '''
%s %s
""" """
Add a description of the plugin (to be presented to the user inside the wizard) %s: %s
here. This should describe *what* the plugin does.
""" """
import supybot import supybot
@ -204,7 +203,9 @@ class %sTestCase(PluginTestCase):
'''.lstrip() '''.lstrip()
readmeTemplate = ''' readmeTemplate = '''
Insert a description of your plugin here, with any notes, etc. about %s
Insert a more detailed description of your plugin here, with any notes, etc. about
using it. using it.
'''.lstrip() '''.lstrip()
@ -220,6 +221,8 @@ def main():
parser.add_option('', '--real-name', action='store', dest='realName', parser.add_option('', '--real-name', action='store', dest='realName',
help='Determines what real name the copyright is ' help='Determines what real name the copyright is '
'assigned to.') 'assigned to.')
parser.add_option('', '--desc', action='store', dest='desc',
help='Short description of plugin.')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if options.name: if options.name:
name = options.name name = options.name
@ -259,6 +262,11 @@ def main():
if not yn('Do you wish to use Supybot\'s license for your plugin?'): if not yn('Do you wish to use Supybot\'s license for your plugin?'):
license = '#' license = '#'
if not options.desc:
options.desc = something(textwrap.dedent("""
Please provide a short description of the plugin.
""").strip())
if threaded: if threaded:
threaded = 'threaded = True' threaded = 'threaded = True'
else: else:
@ -287,9 +295,9 @@ def main():
name, threaded, name)) name, 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) writeFile('__init__.py', __init__Template % (copyright, name, options.desc))
writeFile('test.py', testTemplate % (copyright, name, name)) writeFile('test.py', testTemplate % (copyright, name, name))
writeFile('README.md', readmeTemplate) writeFile('README.md', readmeTemplate % (options.desc,))
pathname = os.path.join(pathname, 'local') pathname = os.path.join(pathname, 'local')
os.mkdir(pathname) os.mkdir(pathname)