Thanks to visit codestin.com
Credit goes to github.com

Skip to content

layerk0/gvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GVM

General Version Manager is a simple command line tool that helps managing versions of programs in a generic way. It only works on unix operating systems such as MacOS and Linux.

Quick Start

Installation:

cargo install gvm-cli

The programs managed by gvm should be in ~/opt and should have the following format: <program-name>-<version>. Most programs are already distributed with this format. One example is nodejs which looks like this: node-v22.18.0-linux-x64, so if you want to manage multiple versions of node, you can just drop the versions in your ~/opt directory and gvm will know what to do.

Usage: gvm <command>

Commands:
    list - List all installed programs
    switch - Switch the version of a program
    path - Retrieve a string that can be prepended to the PATH variable
    path_linked - Retrieve a string that can be prepended to the PATH variable
    link - Create symlinks for the programs

To switch the version of a program just use gvm switch node 22. gvm will know which version to pick because it uses nucleo to fuzzy match the version.

There are two primary ways of adding the programs to the path:

Linked (path_linked, link)

The linked version creates symlink, for every installed program to the selected version. In the case of node this could look like this:

node -> /home/programmer/opt/node-v22.18.0-linux-x64
node-v22.18.0-linux-x64
node-v22.18.0-linux-x64.tar.xz
node-v24.5.0-linux-x64

After running gvm switch <program-name> <version> the symlinks will be regenerated. If you want to manually regenerate them you can run: gvm link.

You can then add the installed versions to your PATH by using gvm path_linked to prepend it to your PATH in your .bashrc (or something else that lets you set the PATH) like this:

PATH=$(gvm path_linked):$PATH

Some programs may contain the binaries we're interested in in a separate directory called bin, in which case gvm will output the path accordingly.

The advantage of using symlinks over directly adding the paths of the versions is that you don't need to reset your PATH. The PATH will still be valid when you change the version because it still points to the correct path.

Direct (path)

You can also ignore the symlinks and directly add the paths to you PATH variable like this:

PATH=$(gvm path):$PATH

Other examples

We've only looked at how to install node, but this exact method can be used to manage several programs. Here are more examples:

node -> /home/programmer/opt/node-v22.18.0-linux-x64
node-v22.18.0-linux-x64
node-v22.18.0-linux-x64.tar.xz
node-v24.5.0-linux-x64
node-v24.5.0-linux-x64.tar.xz
zig -> /home/programmer/opt/zig-x86_64-linux-0.15.0-dev.1254+c9ce1debe
zig-x86_64-linux-0.14.1
zig-x86_64-linux-0.14.1.tar.xz
zig-x86_64-linux-0.15.0-dev.1254+c9ce1debe
zig-x86_64-linux-0.15.0-dev.1254+c9ce1debe.tar.xz
zls -> /home/programmer/opt/zls-0.14.0
zls-0.14.0
zls-x86_64-linux.tar.xz

As you can see I only download the archive, unpack it and manage it with gvm.

About

General Version Manager

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages