mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
supybot-plugin-doc: Allow specifying an output directory
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
faed698932
commit
f3dca89500
@ -152,13 +152,14 @@ class PluginDoc(object):
|
|||||||
self.appendLine(help, indent)
|
self.appendLine(help, indent)
|
||||||
self.genConfig(v, indent)
|
self.genConfig(v, indent)
|
||||||
|
|
||||||
def genDoc(m):
|
def genDoc(m, options):
|
||||||
Plugin = PluginDoc(m)
|
Plugin = PluginDoc(m)
|
||||||
print 'Generating documentation for %s...' % Plugin.name
|
print 'Generating documentation for %s...' % Plugin.name
|
||||||
|
path = os.path.join(options.outputdir, '%s.stx' % Plugin.name)
|
||||||
try:
|
try:
|
||||||
fd = file('%s.stx' % Plugin.name, 'w')
|
fd = file(path, 'w')
|
||||||
except EnvironmentError, e:
|
except EnvironmentError, e:
|
||||||
sys.stderr.write('Unable to open %s.stx for writing.' % Plugin.name)
|
sys.stderr.write('Unable to open %s for writing.' % path)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
try:
|
try:
|
||||||
fd.write(Plugin.renderSTX())
|
fd.write(Plugin.renderSTX())
|
||||||
@ -176,6 +177,9 @@ if __name__ == '__main__':
|
|||||||
parser.add_option('-c', '--clean', action='store_true', default=False,
|
parser.add_option('-c', '--clean', action='store_true', default=False,
|
||||||
dest='clean', help='Cleans the various data/conf/logs '
|
dest='clean', help='Cleans the various data/conf/logs '
|
||||||
'directories after generating the docs.')
|
'directories after generating the docs.')
|
||||||
|
parser.add_option('-o', '--output-dir', dest='outputDir', default='.',
|
||||||
|
help='Specifies the directory in which to write the '
|
||||||
|
'documentation for the plugin.')
|
||||||
parser.add_option('--plugins-dir',
|
parser.add_option('--plugins-dir',
|
||||||
action='append', dest='pluginsDirs', default=[],
|
action='append', dest='pluginsDirs', default=[],
|
||||||
help='Looks in in the given directory for plugins and '
|
help='Looks in in the given directory for plugins and '
|
||||||
@ -210,7 +214,7 @@ if __name__ == '__main__':
|
|||||||
plugins.add(pluginModule)
|
plugins.add(pluginModule)
|
||||||
|
|
||||||
for Plugin in plugins:
|
for Plugin in plugins:
|
||||||
genDoc(Plugin)
|
genDoc(Plugin, options)
|
||||||
|
|
||||||
if options.clean:
|
if options.clean:
|
||||||
shutil.rmtree(conf.supybot.directories.log())
|
shutil.rmtree(conf.supybot.directories.log())
|
||||||
|
Loading…
Reference in New Issue
Block a user