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

feat(cli): new pixi global list display format #723

Merged
merged 7 commits into from
Feb 26, 2024

Conversation

chawyehsu
Copy link
Contributor

Implement #708 (comment) Close #708

example output

❯ .\target\debug\pixi.exe global list
C:\pixi:
├── libssh2@1.11.0
├─┬ pigz@2.8
│ ├──[bin] unpigz.bat
│ └──[bin] pigz.bat
├─┬ python@3.12.1
│ ├──[bin] idle.bat
│ ├──[bin] 2to3.bat
│ ├──[bin] python.bat
│ ├──[bin] pydoc.bat
│ └──[bin] pythonw.bat
└─┬ rattler-build@0.7.0
  └──[bin] rattler-build.bat

Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
@chawyehsu chawyehsu changed the title feat(cli): new pixi global list display format feat(cli): new pixi global list display format Jan 29, 2024
@ruben-arts
Copy link
Contributor

It already looks good but the tree view makes it a look like this is the structure of the folder. Which is not really true.
Maybe something like this would be better:

➜ pixi global list
Gobal install location: /home/rarts/.pixi:
├── starship 1.17.1
│   └─ bin: starship 
├── pre-commit 3.6.0
│   └─ bin: pre-commit
├── grayskull 2.5.3
│   └─ bin: grayskull, greyskull, conda-greyskull, conda-grayskull 
├── zsh 5.8
│   └─ bin: zsh, zsh-5.8 # lists to avoid extremely long output
├── gh 2.40.1
│   └─ bin: gh 
└── ruff 0.1.15
    └─ bin: ruff

  • Color the name and version in different colors to make them easy to parse visually
  • Make the bin a color
  • List the binaries in a line instead of below each other to avoid super long output
  • Possibly color the background of a command to give the feeling of inline code blocks to give the idea of a command.

Please give it your own twirl, it shouln't become a disco but I think it could be easier on the eyes.

A future idea could be to color the version based on how outdated it is. (green = latest, yellow = minor version difference, red = major version difference)

@ruben-arts
Copy link
Contributor

He @chawyehsu, would you want to continue the work on this PR?

@chawyehsu
Copy link
Contributor Author

@ruben-arts Yes but I may be slow on this at the moment. Will make some time on trying to get it accpeted before next weekend.

The aforementioned format looks good to me, I will update the PR to use it. However, there may be predictable line wrap breaking the format when listing binaries in a line if there are many bins or names of bins are longer than terminal width. I don't know if it should be compromised.

Suggested colors output sounds good, too. Coloring version based on how outdated it is may require another network querying? Will try but may not in this branch if the complexity is high.

@ruben-arts
Copy link
Contributor

Thanks @chawyehsu

Good though on the line wrap, I think it should be okay for now.

I think its better to leave the outdated feature out for now to get this pr in sooner.

Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
@chawyehsu
Copy link
Contributor Author

chawyehsu commented Feb 26, 2024

I just pushed the updated format, this is how it currently looks like:

image

Make the bin a color
Possibly color the background of a command to give the feeling of inline code blocks to give the idea of a command.

After a few tries, I found instead of coloring bin and giving a background to name of executable, highlighting the name with color and a * suffix, inspired from the "ls" command, makes it much feeling to me.

Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works very nice! left a few small nitpicks but already in a mergable state! Thanks you

src/cli/global/list.rs Outdated Show resolved Hide resolved
src/cli/global/list.rs Outdated Show resolved Hide resolved
src/cli/global/list.rs Outdated Show resolved Hide resolved
chawyehsu and others added 2 commits February 26, 2024 15:48
Co-authored-by: Ruben Arts <ruben@prefix.dev>
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
@chawyehsu chawyehsu marked this pull request as ready for review February 26, 2024 07:56
@ruben-arts ruben-arts merged commit f850c59 into prefix-dev:main Feb 26, 2024
14 checks passed
@chawyehsu chawyehsu deleted the feature/global-list branch October 11, 2024 09:00
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

Successfully merging this pull request may close these issues.

Add version information to pixi global list
2 participants