mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-25 20:29:23 +01:00
supybot-plugin-doc: Add option --output-filename
It can be used like this to generate README.rst files: ``` supybot-plugin-doc --plugins-dir plugins/ --format rst --output-filename='plugins/$name/README.$format' ```
This commit is contained in:
parent
524e409322
commit
16fc2aef93
@ -234,8 +234,9 @@ class PluginDoc(object):
|
|||||||
def genDoc(m, options):
|
def genDoc(m, options):
|
||||||
Plugin = PluginDoc(m, options.titleTemplate)
|
Plugin = PluginDoc(m, options.titleTemplate)
|
||||||
print('Generating documentation for %s...' % Plugin.name)
|
print('Generating documentation for %s...' % Plugin.name)
|
||||||
path = os.path.join(options.outputDir, '%s.%s' % (Plugin.name,
|
outputFilename = string.Template(options.outputFilename).substitute(
|
||||||
options.format))
|
name=Plugin.name, format=options.format)
|
||||||
|
path = os.path.join(options.outputDir, outputFilename)
|
||||||
try:
|
try:
|
||||||
fd = open(path, 'w')
|
fd = open(path, 'w')
|
||||||
except EnvironmentError as e:
|
except EnvironmentError as e:
|
||||||
@ -263,6 +264,12 @@ if __name__ == '__main__':
|
|||||||
parser.add_option('-o', '--output-dir', dest='outputDir', default='.',
|
parser.add_option('-o', '--output-dir', dest='outputDir', default='.',
|
||||||
help='Specifies the directory in which to write the '
|
help='Specifies the directory in which to write the '
|
||||||
'documentation for the plugin.')
|
'documentation for the plugin.')
|
||||||
|
parser.add_option('--output-filename', dest='outputFilename',
|
||||||
|
default='$name.$format',
|
||||||
|
help='Specifies the path of individual output files. '
|
||||||
|
'If present in the value, "$name" will be substituted '
|
||||||
|
'with the plugin\'s name and "$format" with the value '
|
||||||
|
'if --format.')
|
||||||
parser.add_option('-f', '--format', dest='format', choices=['rst', 'stx'],
|
parser.add_option('-f', '--format', dest='format', choices=['rst', 'stx'],
|
||||||
default='stx', help='Specifies which output format to '
|
default='stx', help='Specifies which output format to '
|
||||||
'use.')
|
'use.')
|
||||||
|
Loading…
Reference in New Issue
Block a user