1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix -M/--module-path option for ansible-doc and ansible-console (#31744)

Fixes #31743
This commit is contained in:
Ilya Margolin 2017-10-16 16:47:40 +02:00 committed by Adrian Likins
parent 2d2656049a
commit 9bc60cd05e
2 changed files with 8 additions and 6 deletions

View file

@ -126,9 +126,10 @@ class ConsoleCLI(CLI, cmd.Cmd):
def list_modules(self):
modules = set()
if self.options.module_path is not None:
for i in self.options.module_path.split(os.pathsep):
module_loader.add_directory(i)
if self.options.module_path:
for path in self.options.module_path:
if path:
module_loader.add_directory(path)
module_paths = module_loader._get_paths()
for path in module_paths:

View file

@ -103,9 +103,10 @@ class DocCLI(CLI):
loader = module_loader
# add to plugin path from command line
if self.options.module_path is not None:
for i in self.options.module_path.split(os.pathsep):
loader.add_directory(i)
if self.options.module_path:
for path in self.options.module_path:
if path:
loader.add_directory(path)
# save only top level paths for errors
search_paths = DocCLI.print_paths(loader)