@ -937,7 +937,7 @@ class DocCLI(CLI, RoleMixin):
return text
return text
@staticmethod
@staticmethod
def find_plugins ( path , internal , ptype , collection = None ):
def find_plugins ( path , internal , ptype , collection = None , depth = 0 ):
# if internal, collection could be set to `ansible.builtin`
# if internal, collection could be set to `ansible.builtin`
display . vvvv ( " Searching %s for plugins " % path )
display . vvvv ( " Searching %s for plugins " % path )
@ -960,6 +960,8 @@ class DocCLI(CLI, RoleMixin):
if plugin . startswith ( ' . ' ) :
if plugin . startswith ( ' . ' ) :
continue
continue
elif os . path . isdir ( full_path ) :
elif os . path . isdir ( full_path ) :
if ptype == ' module ' and not plugin . startswith ( ' __ ' ) and collection is not None and not internal :
plugin_list . update ( DocCLI . find_plugins ( full_path , False , ptype , collection = collection , depth = depth + 1 ) )
continue
continue
elif any ( plugin . endswith ( x ) for x in C . REJECT_EXTS ) :
elif any ( plugin . endswith ( x ) for x in C . REJECT_EXTS ) :
continue
continue
@ -967,9 +969,8 @@ class DocCLI(CLI, RoleMixin):
continue
continue
elif plugin in C . IGNORE_FILES :
elif plugin in C . IGNORE_FILES :
continue
continue
elif plugin . startswith ( ' _ ' ) :
elif os . path . islink ( full_path ) : # avoids aliases
if os . path . islink ( full_path ) : # avoids aliases
continue
continue
plugin = os . path . splitext ( plugin ) [ 0 ] # removes the extension
plugin = os . path . splitext ( plugin ) [ 0 ] # removes the extension
plugin = plugin . lstrip ( ' _ ' ) # remove underscore from deprecated plugins
plugin = plugin . lstrip ( ' _ ' ) # remove underscore from deprecated plugins
@ -977,7 +978,11 @@ class DocCLI(CLI, RoleMixin):
if plugin not in REJECTLIST . get ( bkey , ( ) ) :
if plugin not in REJECTLIST . get ( bkey , ( ) ) :
if collection :
if collection :
plugin = ' %s . %s ' % ( collection , plugin )
composite = [ collection ]
if depth :
composite . extend ( path . split ( os . path . sep ) [ depth * - 1 : ] )
composite . append ( plugin )
plugin = ' . ' . join ( composite )
plugin_list . add ( plugin )
plugin_list . add ( plugin )
display . vvvv ( " Added %s " % plugin )
display . vvvv ( " Added %s " % plugin )