### Summary

`ansible-inventory --graph` can be specified with a group though, the output is not a JSON format so that we cannot parse the output easily.

It would be helpful for us if the `ansible-inventory --list` could accept the group name.


### Issue Type

Feature Idea

### Component Name

inventory

### Additional Information

For example, I created an inventory file.

```
[groupA]
host1
host2
host3

[groupA:children]
groupA1

[groupB]
host11
host12

[groupC]
host21
host22
host23
host24

[groupC:children]
groupA1

[groupA1]
host101
host102
host103
host104
host105
```

Then I can get filtered output with `ansible-inventory --graph`.  It can catch all hosts in the child group as well.

```
$ ansible-inventory -i inventory --graph groupA
@groupA:
  |--@groupA1:
  |  |--host101
  |  |--host102
  |  |--host103
  |  |--host104
  |  |--host105
  |--host1
  |--host2
  |--host3
```

However `ansible-inventory --list` performs to output only for the whole hosts in the inventory.  We need the filtered output as the `--graph` in a JSON format.


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
if context.CLIARGS['yaml']:
            import yaml
            from ansible.parsing.yaml.dumper import AnsibleDumper
            results = to_text(yaml.dump(stuff, Dumper=AnsibleDumper, default_flow_style=False, allow_unicode=True))
        elif context.CLIARGS['toml']:
            from ansible.plugins.inventory.toml import toml_dumps
            try:
                results = toml_dumps(stuff)
            except TypeError as e:
                raise AnsibleError(
                    'The source inventory contains a value that cannot be represented in TOML: %s' % e
                )
            except KeyError as e:
                raise AnsibleError(
                    'The source inventory contains a non-string key (%s) which cannot be represented in TOML. '
                    'The specified key will need to be converted to a string. Be aware that if your playbooks '
                    'expect this key to be non-string, your playbooks will need to be modified to support this '
                    'change.' % e.args[0]
                )
        else:
            import json
            from ansible.parsing.ajson import AnsibleJSONEncoder
            try:
                results = json.dumps(stuff, cls=AnsibleJSONEncoder, sort_keys=True, indent=4, preprocess_unsafe=True, ensure_ascii=False)
            except TypeError as e:
                results = json.dumps(stuff, cls=AnsibleJSONEncoder, sort_keys=False, indent=4, preprocess_unsafe=True, ensure_ascii=False)
                display.warning("Could not sort JSON output due to issues while sorting keys: %s" % to_native(e))
        return results
    def _get_group_variables(self, group):