Spaceship-prompt: asdf support for detecting node version

Created on 22 May 2019  路  7Comments  路  Source: denysdovhan/spaceship-prompt

I saw that ruby version is supported in the prompt via asdf. It would be really great if there was support for asdf to detect the current node version (and maybe other languages).

proposal under-discussion

Most helpful comment

Fully support this! I'm using asdf with python, terraform, ..., etc.
I am actually implementing my own asdf support using spaceship's API now.

All 7 comments

Fully support this! I'm using asdf with python, terraform, ..., etc.
I am actually implementing my own asdf support using spaceship's API now.

+1 for asdf. Since asdf is meant to manage all kinds of programming languages it would be great if spaceship supported it for more languages than just ruby (the ones I'd be most keen on are nodejs, python and rust). :)

Agree with @timonbimon , would like to see spaceship support for other languages like python and nodeJS

Just dropping this here as a heads up, but at asdf we're going to be changing our command outputs to better support human readability by default with columnar output and header rows along with flags to optimise the output for better compatibility with scripts. No ETA on this, but if things break in future this may be why. Ideally the result is easier usage and scripting of asdf for all.

@jthegedus Right on time, I was thinking to submit an issue regarding this when I tried to update spaceship script. Is there related issue created?

As this script to get ruby version seems a bit hacky for me:
https://github.com/denysdovhan/spaceship-prompt/blob/b294f83/sections/ruby.zsh#L38

ruby_version=${$(asdf current ruby)[1]}

Would be great if asdf can support extra args for current so that it can only print out the version, i.e. asdf current ruby --version-only

btw, I think current spaceship works with current node version with asdf, I think the magic is in here:
https://github.com/denysdovhan/spaceship-prompt/blob/master/sections/node.zsh#L37-L39

elif spaceship::exists node; then
  node_version=$(node -v 2>/dev/null)

There's no exact issue, but this started the conversation https://github.com/asdf-vm/asdf/issues/646

Would be great if asdf can support extra args for current so that it can only print out the version, i.e. asdf current ruby --version-only

This is the scenario we want to avoid as each tool will have different requirements, each asdf command having differing numbers of columns etc.

By committing to a structured, consistent output across all our commands (with a single global flag for scripts to disable header rows) the above parsing wouldn't be hacky, so much as parsing expected output.

This bug exists for 2 reasons:

  1. I pushed a format change through prematurely.
  2. everyone here is using asdf head which means at some point this will break for people. IE asdf version 0.8.0 will work here, but logic here will break sometime before 0.9.0

(EDIT) I'm probably going to go through the commands one by one instead of a single large PR to apply these formatting and header row changes, so using a stable release version will save some headache

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwhipp picture jwhipp  路  3Comments

gabrielpedepera picture gabrielpedepera  路  3Comments

Vvkmnn picture Vvkmnn  路  3Comments

MatthiasJ picture MatthiasJ  路  4Comments

janjur picture janjur  路  3Comments