preface
Are you, like me, a software developer who uses a bunch of programming languages? Such as:
Java, C#, JavaScript, Ruby, Python, Go…
Do you, like me, have a stack of Version Mananger’s installed on your computer in all of these languages to manage and switch Runtime versions for different projects? Such as:
Sdkman, NVM, RVM, Pyenv, GVM…
Are you, like me, an obsessive who spends a lot of time trying to choose a language version manager? Such as:
Should I use Sdkman or Jabbar?
Should I use NVM or N?
Should I use RVM or Rbenv?
…
Are you like me, with your hard drive still in a state of disarray, contaminated by language version managers?
Do you wish, like me, that there would be a version manager that could manage all languages?
Do you, like me, use macOS or Linux?
If the above answers are the same as mine, then this article is for you. Let’s introduce the “all-in-one language version manager” : ASDF-VM!
Sorry, I use Windows too, but the artifact doesn’t support it… Sorry)
Asdf – vm is introduced
Asdf-vm is a command line tool that can manage multiple language runtime versions on a project basis. Currently, it supports 150+ languages or common development tools as a plug-in.
The official website is ASdF-VM.com
The tool was first added to the ThoughtWorks Radar in November 2019 and is currently in “evaluation” status.
Evaluate: It’s worth exploring with an understanding of how it will affect your business.
Asdf-vm has the following features compared to installing a bunch of “special-purpose” version management tools:
- Support multiple programming languages with a single command line tool
- Manage all programming languages with identical commands
- You can keep the global default configuration in one place through a configuration file
- Can be done through a
.tool-versions
The configuration file is configured separately based on the project- Support for existing configuration files to facilitate migration of existing version management tools, such as:
.node-version
..nvmrc
..ruby-version
- Automatically switch the runtime version when a directory is switched
- Add support for multiple programming languages through a compact plug-in system
- Scripts are automatically completed by the plug-in’s own management command line, and you don’t need to configure them yourself!
And the name of this tool is also very distinctive – ASDF corresponds to the standard keyboard left hand on the default A, S, D, F four keys, easy to press and easy to remember.
Method of use
The installation method of the tool is very simple and will not be described here, you can see the official website instructions. Here is mainly to show you the common use of the method.
Install language plugins
Once the installation is complete, you can first list all supported language plug-ins with the following command:
asdf plugin list all
Copy the code
Of course, if you want to quickly know whether a certain language is supported, you can use grep to quickly search by keyword, for example:
asdf plugin list all | grep golang
Copy the code
For specific usage requirements and considerations for each language, see the plug-in page for that language.
Install a working version of a language
After installing a language plug-in, you can view all available versions online by using the asdf list all
command, for example:
asdf list all golang
Copy the code
Then, according to your needs, install the specified language version with the asdf install [
Asdf install golang 1.13.6Copy the code
PS: Be careful, if you don’t add a version number, all available versions of the language are installed by default!
After the installation is complete, you can use the following command to display all installed languages and versions:
asdf list
Copy the code
Use an installed version of a language
For everyday use, switching the language version is simple.
To switch only temporarily in the current shell session, use the ASdf shell
command, for example:
Asdf shell golang 1.13.6Copy the code
If you want to use a specific version in a directory, you can use the asdf local
command. This command generates a. Tool -version file in the current folder with the specified language and version number. It will automatically switch to the corresponding language version (while also compatible with other common version manager configuration files), for example:
Asdf local golang 1.13.6Copy the code
If you want to set the default language version globally, you can use the asdf global
command, which generates a. Tool -version file in the user’s $HOME folder to record the default language and version number, for example:
Asdf global golang 1.13.6Copy the code
How’s that? Is the above command easy to use?
From now on, replace the various dedicated runtime version managers on your computer one by one with ASDF-VM.
Welcome to pay attention to my personal public number
Wechat search: Guns and Code, or search the public ID: guns-N-code