DOCUMENTATION:
  name: commonpath
  author: Shivam Durgbuns
  version_added: "2.15"
  short_description: gets the common path
  description:
    - Returns the longest common path from the given list of paths.
  options:
    _input:
      description: A list of paths.
      type: list
      elements: path
      required: true
  seealso:
    - plugin: ansible.builtin.basename
      plugin_type: filter
EXAMPLES: |

  # To get the longest common path (for example - '/foo/bar') from the given list of paths
  # (for example - ['/foo/bar/foobar','/foo/bar'])
  {{ listofpaths | commonpath }}

RETURN:
  _value:
    description: The longest common path from the given list of paths.
    type: path
