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

tools: use expansion character/string to format home paths in vpm output #19847

Merged
merged 1 commit into from
Nov 12, 2023

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Nov 11, 2023

E.g.

# On Lin/mac
Updating `sdl` in `/home/username/.vmodules/sdl`
# would become
Updating `sdl` in `~/.vmodules/sdl`

# On Windows
Updating `sdl` in `C:\Users\username\.vmodules\sdl`
# would become
Updating `sdl` in `%USERPROFILE%\.vmodules\sdl`

🤖 Generated by Copilot at eca32a9

Improved the output and user experience of vpm by adding formatted paths, colors, alignment, and progress indicators. Modified the Module struct and several functions in cmd/tools/vpm/common.v, cmd/tools/vpm/install.v, and cmd/tools/vpm/update.v.

🤖 Generated by Copilot at eca32a9

  • Add a new field install_path_fmted to the Module struct to store a formatted version of the vmodules install path (link, link, link)
  • Define a new constant home_dir to store the result of os.home_dir() function and avoid repeated calls (link)
  • Define a new function fmt_mod_path to format the vmodules install path by replacing the home directory with a tilde or an environment variable depending on the OS (link)
  • Use the install_path_fmted field instead of the install_path field in the output messages of the relocate, install, remove, and update functions in install.v and update.v to make the output more user-friendly and consistent (link, link, link, link, link, link)

@spytheman spytheman merged commit fbb43f5 into vlang:master Nov 12, 2023
43 checks passed
@ttytm ttytm deleted the tools.vpm/use-home-expansion-fmt branch November 13, 2023 14:46
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.

2 participants