xcodes icon indicating copy to clipboard operation
xcodes copied to clipboard

Feature request: print selected version

Open amosolgo-lutron opened this issue 3 years ago • 1 comments

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.

amosolgo-lutron avatar Feb 16 '23 17:02 amosolgo-lutron

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!

amosolgo-lutron avatar Feb 16 '23 18:02 amosolgo-lutron