Open amosolgo-lutron opened 1 year ago
It looks like the currently selected version is already easily accessible in selectXcode
:
https://github.com/RobotsAndPencils/xcodes/blob/17f8c9580501138cccdf0405c7a430d63df660e5/Sources/XcodesKit/XcodeSelect.swift#L29
Perhaps that assignment could be made easrlier in the function and another block like if shouldPrint {
could be added with shouldPrintVersion
to print the version instead.
I don't have time to open a PR now, but I wanted to share what I found in case anyone else is interested in implementing this!
It's possible to parse the currently selected version number with something like:
xcodes installed | grep "Selected" | awk '{print $1}'
But this relies on parsing output that is intended for human readers, which is usually not reliable or recommended practice.
Can we add an option to print the selected version? Perhaps it could be similar to
xcodes select --print-path
, but using--print-version
/-v
instead.