Skip to content
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

Mark global versions in the output of list command #617

Closed
maxdanilov opened this issue Dec 11, 2019 · 1 comment · Fixed by #762
Closed

Mark global versions in the output of list command #617

maxdanilov opened this issue Dec 11, 2019 · 1 comment · Fixed by #762

Comments

@maxdanilov
Copy link

maxdanilov commented Dec 11, 2019

Expected behavior

Would be user friendly if the list command would somehow mark the currently selected versions of the environments.

asdf list
golang
    1.13.2
  * 1.13.4
groovy
    apache-groovy-binary-2.4.12
  * apache-groovy-binary-2.5.8

This way it's clear that go 1.13.4 and groovy 2.5.8 would be used.
I'm aware of asdf current, but it only shows the currently selected versions, without the context of what else is installed.

Actual behavior

asdf list
golang
  1.13.2
  1.13.4
groovy
  apache-groovy-binary-2.4.12
  apache-groovy-binary-2.5.8

Environment

OS: MacOS 10.15.1

asdf version: v0.7.5

@jthegedus jthegedus changed the title [Proposal] Mark global versions in the output of list command Mark global versions in the output of list command Sep 8, 2020
@cho-m
Copy link

cho-m commented Mar 1, 2021

So there was a PR for this (#761 and duplicate #762), but it didn't get much traction.
It would be nice to get a review on one of those to see if a different aesthetic/solution is needed.

The available PR output looks like a whitespace-lacking chruby-style output.
It should also be possibly to extend PR to create pyenv/rbenv-style output.

One possible demerit would be the fact that asdf current is slower than asdf list. By running current inside list, the command will be noticeably slower:

❯ hyperfine 'asdf list' 'asdf current'
Benchmark #1: asdf list
  Time (mean ± σ):      22.8 ms ±   0.6 ms    [User: 6.6 ms, System: 13.4 ms]
  Range (min … max):    20.8 ms …  25.3 ms    114 runs

Benchmark #2: asdf current
  Time (mean ± σ):     189.8 ms ±   1.7 ms    [User: 57.3 ms, System: 142.6 ms]
  Range (min … max):   188.4 ms … 194.8 ms    15 runs

Summary
  'asdf list' ran
    8.33 ± 0.22 times faster than 'asdf current'


❯ hyperfine --warmup 3 'asdf list ruby' 'asdf current ruby'
Benchmark #1: asdf list ruby
  Time (mean ± σ):      12.6 ms ±   0.3 ms    [User: 4.3 ms, System: 6.7 ms]
  Range (min … max):    11.2 ms …  13.5 ms    205 runs

Benchmark #2: asdf current ruby
  Time (mean ± σ):      61.7 ms ±   0.5 ms    [User: 18.7 ms, System: 45.4 ms]
  Range (min … max):    60.8 ms …  62.8 ms    46 runs

Summary
  'asdf list ruby' ran
    4.88 ± 0.13 times faster than 'asdf current ruby'

This "marker" feature is available in most other version managers. The exact output is different based on tool, but here is a compilation of examples from some alternatives. It may be worth chiming-in on what output is best:

  1. Ruby - chruby

    $ chruby 1.9.3
    $ chruby
     * ruby-1.9.3-p392
       jruby-1.7.0
       rubinius-2.0.0-rc1
  2. Ruby - RVM

    $ rvm list
    
      rvm rubies
    
       * ruby-1.9.3-p484 [ x86_64 ]
         ruby-2.0.0-p481 [ x86_64 ]
      => ruby-2.1.1 [ x86_64 ]
    
      # => - current
      # =* - current && default
      #  * - default
  3. Ruby - rbenv

    $ rbenv versions
      1.8.7-p352
      1.9.2-p290
    * 1.9.3-p327 (set by /Users/sam/.rbenv/version)
  4. Python - pyenv - forked from rbenv, so output is similar

    $ pyenv versions
      2.7.10
    * 3.5.0 (set by /Users/yuu/.pyenv/version)
      miniconda3-3.16.0
      pypy-2.6.0
  5. NodeJS - nvm - also has color-coded output

    $ nvm ls
           v10.15.0
    ->     v11.10.0
           system
    ...
  6. Go - gvm

    $ gvm list
    
    gvm gos (installed)
    
       go1.12.8
    => system
  7. Rust - rustup - shows active toolchain and lists global default.

    ❯ rustup show
    Default host: aarch64-apple-darwin
    rustup home:  /Users/cho-m/.local/share/rustup
    
    installed toolchains
    --------------------
    
    stable-aarch64-apple-darwin (default)
    nightly-aarch64-apple-darwin
    
    active toolchain
    ----------------
    
    nightly-aarch64-apple-darwin (directory override for '/Users/cho-m/Workspace/test')
    rustc 1.52.0-nightly (e37a13cc3 2021-02-28)
    

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

Successfully merging a pull request may close this issue.

4 participants