# package version displayancestry

Display the ancestry tree for a 2GP managed package version.

## Aliases for package version displayancestry

`force:package:version:displayancestry`

## Flags

| Flag Name (Long)   | Flag Name (Short) | Description                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-version`    | N/A               | **Type:** Value<br><br>Override the api version used for api requests made by this command                                                                                                                                                                                                                                                                                                                                              |
| `--dot-code`       | N/A               | **Type:** Boolean<br><br>Display the ancestry tree in DOT code.<br><br>You can use the DOT code output in graph visualization software to create tree visualizations.                                                                                                                                                                                                                                                                   |
| `--flags-dir`      | N/A               | **Type:** Value<br><br>Import flag values from a directory.                                                                                                                                                                                                                                                                                                                                                                             |
| `--json`           | N/A               | **Type:** Boolean<br><br>Format output as json.                                                                                                                                                                                                                                                                                                                                                                                         |
| `--package`        | `-p`              | **Type:** Value<br>**Required**<br><br>ID or alias of the package (starts with 0Ho) or package version (starts with 04t) to display ancestry for.<br><br>If you specify a package ID (starts with 0Ho) or alias, the ancestor tree for every package version associated with the package ID is displayed. If you specify a package version (starts with 04t) or alias, the ancestry tree of the specified package version is displayed. |
| `--target-dev-hub` | `-v`              | **Type:** Value<br>**Required**<br><br>Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set.                                                                                                                                                                                                                                                                                |
| `--verbose`        | N/A               | **Type:** Boolean<br><br>Display both the package version ID (starts with 04t) and the version number (major.minor.patch.build) in the ancestry tree.                                                                                                                                                                                                                                                                                   |

## Examples for package version displayancestry

Display the ancestry tree for a package version with the specified alias, using your default Dev Hub org:

```shell
sf package version displayancestry --package package_version_alias
```

Similar to previous example, but display the output in DOT code:

```shell
sf package version displayancestry --package package_version_alias --dot-code
```

Display the ancestry tree for a package with the specified ID, using the Dev Hub org with username <devhub@example.com>:

```shell
sf package version displayancestry --package OHo... --target-dev-hub devhub@example.com
```

Display the ancestry tree of a package version with the specified ID, using your default Dev Hub org:

```shell
sf package version displayancestry --package 04t...
```
