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): def list_modules(self):
modules = set() modules = set()
if self.options.module_path is not None: if self.options.module_path:
for i in self.options.module_path.split(os.pathsep): for path in self.options.module_path:
module_loader.add_directory(i) if path:
module_loader.add_directory(path)
module_paths = module_loader._get_paths() module_paths = module_loader._get_paths()
for path in module_paths: for path in module_paths:

View file

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