@ -259,7 +259,7 @@ class DocCLI(CLI):
# The doc section existed but was empty
# The doc section existed but was empty
continue
continue
plugin_docs [ plugin ] = { ' doc ' : doc , ' examples ' : plainexamples , ' return ' : returndocs , ' metadata ' : metadata }
plugin_docs [ plugin ] = DocCLI . _combine_plugin_doc ( plugin , plugin_type , doc , plainexamples , returndocs , metadata )
if do_json :
if do_json :
jdump ( plugin_docs )
jdump ( plugin_docs )
@ -354,6 +354,19 @@ class DocCLI(CLI):
doc [ ' collection ' ] = collection_name
doc [ ' collection ' ] = collection_name
return doc , plainexamples , returndocs , metadata
return doc , plainexamples , returndocs , metadata
@staticmethod
def _combine_plugin_doc ( plugin , plugin_type , doc , plainexamples , returndocs , metadata ) :
# generate extra data
if plugin_type == ' module ' :
# is there corresponding action plugin?
if plugin in action_loader :
doc [ ' has_action ' ] = True
else :
doc [ ' has_action ' ] = False
# return everything as one dictionary
return { ' doc ' : doc , ' examples ' : plainexamples , ' return ' : returndocs , ' metadata ' : metadata }
@staticmethod
@staticmethod
def format_plugin_doc ( plugin , plugin_type , doc , plainexamples , returndocs , metadata ) :
def format_plugin_doc ( plugin , plugin_type , doc , plainexamples , returndocs , metadata ) :
collection_name = doc [ ' collection ' ]
collection_name = doc [ ' collection ' ]
@ -369,18 +382,6 @@ class DocCLI(CLI):
doc [ ' returndocs ' ] = returndocs
doc [ ' returndocs ' ] = returndocs
doc [ ' metadata ' ] = metadata
doc [ ' metadata ' ] = metadata
# generate extra data
if plugin_type == ' module ' :
# is there corresponding action plugin?
if plugin in action_loader :
doc [ ' action ' ] = True
else :
doc [ ' action ' ] = False
doc [ ' now_date ' ] = datetime . date . today ( ) . strftime ( ' % Y- % m- %d ' )
if ' docuri ' in doc :
doc [ ' docuri ' ] = doc [ plugin_type ] . replace ( ' _ ' , ' - ' )
if context . CLIARGS [ ' show_snippet ' ] and plugin_type == ' module ' :
if context . CLIARGS [ ' show_snippet ' ] and plugin_type == ' module ' :
text = DocCLI . get_snippet_text ( doc )
text = DocCLI . get_snippet_text ( doc )
else :
else :
@ -658,7 +659,7 @@ class DocCLI(CLI):
text . append ( " %s " % doc . pop ( ' deprecated ' ) )
text . append ( " %s " % doc . pop ( ' deprecated ' ) )
text . append ( " \n " )
text . append ( " \n " )
if doc . pop ( ' action' , False ) :
if doc . pop ( ' has_ action' , False ) :
text . append ( " * note: %s \n " % " This module has a corresponding action plugin. " )
text . append ( " * note: %s \n " % " This module has a corresponding action plugin. " )
if doc . get ( ' options ' , False ) :
if doc . get ( ' options ' , False ) :