# Buggy code
def post_process_args(self, options, args):
    options, args = super(DocCLI, self).post_process_args(options, args)

    if [
        options.all_plugins,
        options.json_dump,
        options.list_dir,
        options.list_files,
        options.show_snippet,
    ].count(True) > 1:
        raise AnsibleOptionsError(
            "Only one of -l, -F, -s, -j or -a can be used at the same time."
        )

    display.verbosity = options.verbosity

    # process all plugins of type
    if options.all_plugins:
        args = self.get_all_plugins_of_type(options["type"])
        if options.module_path:
            display.warning(
                'Ignoring "--module-path/-M" option as "--all/-a" only displays builtins'
            )

    return options, args


# Traceback (TypeError)
### on stable-2.7 branch

$ ansible-doc -a -vvv
ansible-doc 2.7.7.post0 (stable-2.7 bedfa3f3ff) last updated 2019/02/11 19:35:38 (GMT +550)
config file = None
configured module search path = [u'/home/akhisti/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/akhisti/work/myspace/ansible/lib/ansible
executable location = /home/akhisti/work/myspace/ansible/bin/ansible-doc
python version = 2.7.15 (default, Oct 15 2018, 15:26:09) [GCC 8.2.1 20180801 (Red Hat 8.2.1-2)]
No config file found; using defaults
ERROR! Unexpected Exception, this is probably a bug: get_all_plugins_of_type() takes exactly 2 arguments (3 given)
the full traceback was:

Traceback (most recent call last):
File "/home/akhisti/work/myspace/ansible/bin/ansible-doc", line 118, in <module>
exit_code = cli.run()
File "/home/akhisti/work/myspace/ansible/lib/ansible/cli/doc.py", line 120, in run
self.args = self.get_all_plugins_of_type(plugin_type, loader)
TypeError: get_all_plugins_of_type() takes exactly 2 arguments (3 given)



### on devel branch

$ ansible-doc --all
ERROR! Unexpected Exception, this is probably a bug: Values instance has no attribute '__getitem__'
the full traceback was:

Traceback (most recent call last):
File "/home/akhisti/work/myspace/ansible/bin/ansible-doc", line 110, in <module>
exit_code = cli.run()
File "/home/akhisti/work/myspace/ansible/lib/ansible/cli/doc.py", line 91, in run
super(DocCLI, self).run()
File "/home/akhisti/work/myspace/ansible/lib/ansible/cli/__init__.py", line 101, in run
self.parse()
File "/home/akhisti/work/myspace/ansible/lib/ansible/cli/__init__.py", line 422, in parse
options, args = self.post_process_args(options, args)
File "/home/akhisti/work/myspace/ansible/lib/ansible/cli/doc.py", line 83, in post_process_args
args = self.get_all_plugins_of_type(options['type'])
AttributeError: Values instance has no attribute '__getitem__'

# Fixed code
def post_process_args(self, options, args):
    options, args = super(DocCLI, self).post_process_args(options, args)

    if [
        options.all_plugins,
        options.json_dump,
        options.list_dir,
        options.list_files,
        options.show_snippet,
    ].count(True) > 1:
        raise AnsibleOptionsError(
            "Only one of -l, -F, -s, -j or -a can be used at the same time."
        )

    display.verbosity = options.verbosity

    # process all plugins of type
    if options.all_plugins:
        args = self.get_all_plugins_of_type(options.type)
        if options.module_path:
            display.warning(
                'Ignoring "--module-path/-M" option as "--all/-a" only displays builtins'
            )

    return options, args