Fix -M/--module-path option for ansible-doc and ansible-console (#31744)
Fixes #31743
This commit is contained in:
parent
2d2656049a
commit
9bc60cd05e
2 changed files with 8 additions and 6 deletions
|
@ -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:
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue