Skip to content

'asdf current' output has changed #2849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mgrundie-r7 opened this issue Mar 18, 2025 · 9 comments
Closed

'asdf current' output has changed #2849

mgrundie-r7 opened this issue Mar 18, 2025 · 9 comments

Comments

@mgrundie-r7
Copy link

mgrundie-r7 commented Mar 18, 2025

I know this project is no longer being maintained, reporting so others can find the issue. ASDF made breaking changes in v0.16.0
https://asdf-vm.com/guide/upgrading-to-v0-16.html#breaking-changes

❯ asdf current
Name            Version         Source                                                                 Installed
golang          1.23.2          /Users/mgrundie/.tool-versions                                         true
java            nexpose_java17  /Users/mgrundie/.tool-versions                                         true
kubectl         1.30.5          /Users/mgrundie/.tool-versions                                         true
maven           nexpose_maven   /Users/mgrundie/.tool-versions                                         true
poetry          2.1.1           /Users/mgrundie/.tool-versions                                         true
python          3.13.2          /Users/mgrundie/dir/project/.tool-versions true
ruby            system          /Users/mgrundie/.tool-versions                                         true
terraform       1.9.7           /Users/mgrundie/.tool-versions

This negatively affects typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global) since the expected output no longer match

  # - shell   `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable"
  # - local   `asdf current` says "set by /some/not/home/directory/file"
  # - global  `asdf current` says "set by /home/username/file"
@romkatv
Copy link
Owner

romkatv commented Mar 18, 2025

Thanks for reporting this, and so clearly, too! I'll take a look.

I'm maintaining Powerlevel10k. It still works as intended and I'm keeping it that way. I don't do user support, or at least not nearly as much as before, and I don't implement new features.

@mgrundie-r7
Copy link
Author

No problem, and thanks, I appreciate your work. I dabbled with starship but its just not the same ha.

fyi, it looks like they also removed asdf shell command that allowed you to set tool versions temporarily
asdf-vm/asdf#1911

@romkatv
Copy link
Owner

romkatv commented Mar 18, 2025

I dabbled with starship but its just not the same ha.

Yes, that should be clear to anyone who codes. Starship has a sleek website and honestly great docs. It's easy to set up and customize, which makes it attractive to many zsh users. The only real downside is that the prompt itself isn't as good as p10k. Most won't notice, and those who could tell usually don't try both.

@mgrundie-r7
Copy link
Author

mgrundie-r7 commented Mar 18, 2025

Apologies, you can probably close this. I'm not so sure this is actually broken. The comments in the config file made me think that p10k executes and parses asdf current but viewing the internal/p10k.zsh I see it actually reads the version files and doesn't call asdf current

Basically I wasn't seeing python version when changing into a python dir with the version in .tool-versions. However I see that it does appear when I make local the version different from global version (~/.tool-versions).

My setting = typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global)
Although the comment below made me think my current (the default) setting should cause it to still be shown since it contains 'local'

# POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't
# contain "local".

Example of python version not appearing when local == global

~ 20:52:14

❯ asdf current
Name            Version         Source                         Installed
golang          1.23.2          /Users/mgrundie/.tool-versions true
java            nexpose_java17  /Users/mgrundie/.tool-versions true
kubectl         1.30.5          /Users/mgrundie/.tool-versions true
maven           nexpose_maven   /Users/mgrundie/.tool-versions true
poetry          2.1.1           /Users/mgrundie/.tool-versions true
python          3.13.2          /Users/mgrundie/.tool-versions true
ruby            system          /Users/mgrundie/.tool-versions true
terraform       1.9.7           /Users/mgrundie/.tool-versions true

~ 20:52:20

❯ cd dir/project

~/dir/project !30 ?2 20:52:34       <-- Python version segment doesn't appear when vers is same as global

❯ asdf set python 3.13.1

~/dir/project initial-changes !31 ?2  3.13.1 20:53:09     <-- Python version segment appears

❯

@romkatv
Copy link
Owner

romkatv commented Mar 18, 2025

I might be too sleepy to understand your message properly right now, but does this illuminate?

  • # If set to false, hide tool versions that are the same as global.
    #
    # Note: The name of this parameter doesn't reflect its meaning at all.
    # Note: If this parameter is set to true, it won't hide tools.
    # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW.
    typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false
  • # Special note on the difference between POWERLEVEL9K_ASDF_SOURCES and
    # POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW. Consider the effect of the following commands:
    #
    # asdf local python 3.8.1
    # asdf global python 3.8.1
    #
    # After running both commands the current python version is 3.8.1 and its source is "local" as
    # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false,
    # it'll hide python version in this case because 3.8.1 is the same as the global version.
    # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't
    # contain "local".

@mgrundie-r7
Copy link
Author

Yea those code comments seem to indicate that if POWERLEVEL9K_ASDF_SOURCES contains 'local' then the tool version WILL be shown even if local version == global version.

So for my setup:
Global Python (home dir) == Local Python(project dir) == 3.13.2
POWERLEVEL9K_ASDF_SOURCES=(shell local global)

But python version is NOT shown in the prompt when in the project dir (local) until I make it different from the global version.

It does appear to be a bug but I'm not sure that it's related to the asdf v0.16 changes

@romkatv
Copy link
Owner

romkatv commented Mar 19, 2025

The comments indicate something close to what you are inferring but not quite that. The last comment I quoted shows an example of the same situation you are encountering.

@mgrundie-r7
Copy link
Author

mgrundie-r7 commented Mar 19, 2025

Ok, I understand, at first the 2 statements seem contradictory:

# If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false, 
# it'll hide python version in this case because 3.8.1 is the same as the global version. 
# POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't 
# contain "local". 

But actually they relate to 2 completely separate settings.

Updating my config to the below setting makes it work as I expected.

typeset -g POWERLEVEL9K_ASDF_SOURCES=(local)
typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=true

Closing, sorry this turned into user support 😅

@romkatv
Copy link
Owner

romkatv commented Mar 19, 2025

No worries! The names of these parameters aren't intuitive, and the interactions between them are complex. The docs are precise though. This combination is quite common when it comes to p10k configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants