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

[Feature]: Consistent list outputs #277

Closed
rgustafson-ie opened this issue May 17, 2024 · 7 comments · Fixed by #285
Closed

[Feature]: Consistent list outputs #277

rgustafson-ie opened this issue May 17, 2024 · 7 comments · Fixed by #285
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rgustafson-ie
Copy link

1. Your usage scenarios?

Using version 0.5.2. Running commands that list output, such as vfox list or vfox current, and trying to visually interpret the output. Currently the ordering appears to randomly vary.

2. What is your expected outcome?

To ease comprehension, the output should be consistently ordered (e.g. alphabetical) for the subcommand, and ideally consistent across subcommands.

For example, two runs of vfox current:

vfox current
java -> N/A 
maven -> N/A 
nodejs -> N/A 
python -> N/A 

vfox current
python -> N/A 
java -> N/A 
maven -> N/A 
nodejs -> N/A 
@rgustafson-ie rgustafson-ie added the enhancement New feature or request label May 17, 2024
@aooohan
Copy link
Member

aooohan commented May 20, 2024

We can sort them in alphabetical order.

@aooohan aooohan added the good first issue Good for newcomers label May 20, 2024
@mchgood
Copy link
Contributor

mchgood commented May 21, 2024

Hello, I am very interested in this issue and would like to claim it for resolution. Could you please assign it to me?

@Chance-fyi
Copy link
Member

@mchgood Hi, I'm glad you're interested in solving it. I've assigned it to you.

@aooohan aooohan linked a pull request May 22, 2024 that will close this issue
@ccavolt
Copy link

ccavolt commented May 22, 2024

Will this also fix the random reordering that occurs in .tool-versions when rebuilding a devcontainer? The versions don't change, just for example if I have elixir and erlang installed, sometimes erlang will be on top, sometimes elixir. I can create a separate issue if this isn't related.

@mchgood
Copy link
Contributor

mchgood commented May 23, 2024

Will this also fix the random reordering that occurs in .tool-versions when rebuilding a devcontainer? The versions don't change, just for example if I have elixir and erlang installed, sometimes erlang will be on top, sometimes elixir. I can create a separate issue if this isn't related.这也将修复中发生的随机重新排序。重建devcontainer时的工具版本?版本不会改变,例如,如果我安装了elixir和erlang,有时erlang会在上面,有时elixir。我可以创建一个单独的问题,如果这不是相关的。

I think this issue has already been fixed

@Chance-fyi
Copy link
Member

Will this also fix the random reordering that occurs in .tool-versions when rebuilding a devcontainer? The versions don't change, just for example if I have elixir and erlang installed, sometimes erlang will be on top, sometimes elixir. I can create a separate issue if this isn't related.

@ccavolt You caught me! I noticed this, but I thought it wasn't a frequent operation, so I didn't mention it. Haha.

I think this issue has already been fixed

@mchgood It's not resolved yet. The code related to this functionality is here.

func notInstalled(manager *internal.Manager) (plugins []string, sdks map[string]string, err error) {
tvs, err := toolset.NewMultiToolVersions([]string{
manager.PathMeta.WorkingDirectory,
manager.PathMeta.CurTmpPath,
manager.PathMeta.HomePath,
})
if err != nil {
return
}
sdks = tvs.FilterTools(func(name, version string) bool {
lookupSdk, err := manager.LookupSdk(name)
if err != nil {
plugins = append(plugins, name)
return true
}
if !lookupSdk.CheckExists(internal.Version(version)) {
return true
}
return false
})
return
}

@aooohan
Copy link
Member

aooohan commented May 23, 2024

The code related to this functionality is here.

No. The problem should be here, the FileRecord is use map to record something which lead to random sorting.

type FileRecord struct {
Record map[string]string
Path string
isInitEmpty bool
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants