daml
daml copied to clipboard
Clarify version selection in `daml version`
Extracted from #7385. At the moment there are three ways in which the version can be set: there is a global default, the closest daml.yaml parent, or the DAML_SDK_VERSION env var. These (and their relative priorities) are documented, but not easily discoverable. It's also not quite clear which one is actually being used from the output of daml version when all three match. I think it would be clearer if we separated the list of installed versions from the list of versions set, and we always showed all ways of setting a version. For example, something like:
DAML SDK versions installed:
0.0.0
1.4.0
1.5.0-snapshot.20200811.4959.0.bbc2fe56
1.5.0-snapshot.20200818.5027.0.1b33d374
1.5.0-snapshot.20200902.5118.0.2b3cf1b3
SDK version selected:
ignoring env var SDK_DAML_VERSION (unset)
using 1.4.0 from /full/path/to/daml.yaml
ignoring 1.5.0 (default)
This has a couple advantages over the current situation:
- It makes which version is going to be used very clear.
- It makes it clear which versions are installed (in the current scheme, you could list a version that is not installed).
- It shows all the ways there are to set the version used, making them more discoverable.
I also think if we do find a daml.yaml it's useful to print the full path, just in case the user got distracted.