- release_tracks: [ALPHA, BETA, GA]
  help_text:
    brief: Get the ancestors for a project.
    description: |
      *{command}* displays the ancestors for a project. Projects may be grouped under folders and an organization. This comand will print the folder and organization hierarchy for the given project.
    examples: |
      To print the ancestors for a project with ID `my-project`, run:

        $ {command} my-project

  request:
    collection: cloudresourcemanager.projects
    use_relative_name: false
    method: getAncestry

  arguments:
    resource:
      help_text: The project for which to display ancestors.
      spec: !REF googlecloudsdk.command_lib.projects.resources:project

  output:
    flatten: ['ancestor[].resourceId']
    format: table(id, type)
