-
Notifications
You must be signed in to change notification settings - Fork 483
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
ls: no-trunc opt #2138
ls: no-trunc opt #2138
Conversation
commands/ls.go
Outdated
majorPlatforms := map[string]struct{}{ | ||
"linux/amd64": {}, | ||
"linux/arm64": {}, | ||
"linux/arm/v7": {}, | ||
"linux/mips64": {}, | ||
"linux/ppc64le": {}, | ||
"linux/riscv64": {}, | ||
"linux/s390x": {}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following platforms take priority but let me know if we should change that.
db1dd93
to
94cdae5
Compare
commands/ls_test.go
Outdated
name: "all preferred", | ||
platforms: []string{"darwin/arm64*", "linux/arm64*", "linux/arm/v5*", "linux/arm/v6*", "linux/arm/v7*", "windows/arm64*"}, | ||
expected: []string{"linux/arm64*", "linux/arm/v7*", "darwin/arm64*", "linux/arm/v5*"}, | ||
truncated: true, | ||
max: 4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we always display all preferred platforms even if it exceeds the limit?
commands/ls_test.go
Outdated
name: "no major preferred", | ||
platforms: []string{"linux/amd64/v2*", "linux/arm/v6*", "linux/mips64le*", "linux/amd64", "linux/amd64/v3", "linux/386", "linux/arm64", "linux/riscv64", "linux/ppc64le", "linux/s390x", "linux/mips64", "linux/arm/v7"}, | ||
expected: []string{"linux/amd64", "linux/arm64", "linux/riscv64", "linux/ppc64le"}, | ||
truncated: true, | ||
max: 4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should preferred platforms take priority even if not part of major ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better output could be linux/arm64, linux/amd64 (N more)
For the amd64 variants, I guess we could just show the maximum variant with truncated mode.
cda6a69
to
3a19fa5
Compare
👍
Hum so for |
If you think it is confusing, then I think better to not show variant at all in truncated view. We should not show |
3a19fa5
to
494f85f
Compare
commands/ls_test.go
Outdated
platforms: []string{"linux/arm64*", "linux/amd64", "linux/amd64/v2", "linux/riscv64", "linux/ppc64le", "linux/s390x", "linux/386", "linux/mips64le", "linux/mips64", "linux/arm/v7", "linux/arm/v6"}, | ||
expected: []string{"linux/arm64*", "linux/amd64", "linux/arm/v7", "linux/ppc64le"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the priority over popular platforms to iterate over them until finding a match instead of using a map so we add some weight from the list.
I think this truncated output makes sense based on popular CPU architectures. I will take a look about stripping the variant.
Signed-off-by: CrazyMax <[email protected]>
@tonistiigi Updated to take variants into account, see PR description. |
follow-up #830 with the
no-trunc
opt.When using
ls
, platforms can get wieldy easily and make output in the terminal difficult to read:With this change only
platforms
are truncated by default and only when using thetable
format. We only display "common" platforms with a limitation to 4 and put add a count for number of variants found: