[SalesForce] Retrieving package install URL via sfdx

I'm upgrading our build system to use sfdx, and I'm trying to automate all packaging operations for our managed package.

Once a new package version has been created via sfdx, I would like to retrieve the package installation URL so that I can document it somewhere. I tried using sfdx force:package1:version:display, but I was surprised to see that it only returns things I already know and supplied at build time (package name, version and ID). There is no sign of the package install URL.

Is there a way to programmatically retrieve the install URL from a package that I just created with sfdx?

Edit: apparently the install URL can be created like this:

https://login.salesforce.com/packaging/installPackage.apexp?p0=<package version ID>

Would this work?

Edit: I'm using 1st generation packaging (1GP). I'm not planning to use 2GP.

Best Answer

You can add the --verbose flag to sfdx force:package:version:list and it will give you the Installation URLs

sfdx force:package:version:list --verbose