rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Machine-readable output

Open fenhl opened this issue 9 years ago • 6 comments

I used to have a function in my shell that shows when the current directory is running on a multirust toolchain other than stable. The current formatting is making the port to rustup.rs difficult. An option to generate machine-readable output (preferably JSON) on relevant commands like rustup show and rustup override list would be great.

fenhl avatar May 12 '16 05:05 fenhl

Yes indeed. Sorry for breaking your stuff, but I did make the decision to cater to human-reading first.

Since this is mostly for shell scripts I'd guess it's best to do something simple and line-oriented. The default 'smart' behavior of show where it decides how much to show or not would be bad.

Perhaps a scheme like

  • rustup show active-toolchain --machine-readable
  • rustup show active-toolchain-version --machine-readable
  • rustup toolchain list --machine-readable

brson avatar May 13 '16 20:05 brson

Since this is mostly for shell scripts

It would be useful in IntelliJ Rust as well, though I would also prefer simple text format.

matklad avatar Sep 07 '16 12:09 matklad

This looks like it could be useful for Neon too -- +1 to shell script-friendliness. For the time being I may end up parsing the output of rustc --version or rustup toolchain list, but a stable machine-readable output would be awesome!

dherman avatar Apr 03 '17 03:04 dherman

Any progress on this?

alexreg avatar May 04 '17 20:05 alexreg

Still needed

QAston avatar Feb 19 '23 16:02 QAston

Found this because I wanted to do something like:

cd some/path
toolchain_name=$(rustup show active-toolchain)
cd some/other/path
RUSTUP_TOOLCHAIN=$toolchain_name cargo ...

camsteffen avatar Jul 11 '25 01:07 camsteffen