Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prantlf/zigup
Upgrades to the latest version of Zig, or manages more versions of Zig on the same machine, supporting all platforms including RISC-V, as simple es rustup.
https://github.com/prantlf/zigup
bash install shell version version-manager zig zsh
Last synced: 26 days ago
JSON representation
Upgrades to the latest version of Zig, or manages more versions of Zig on the same machine, supporting all platforms including RISC-V, as simple es rustup.
- Host: GitHub
- URL: https://github.com/prantlf/zigup
- Owner: prantlf
- License: mit
- Created: 2024-08-18T10:27:38.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-09-29T14:49:42.000Z (about 1 month ago)
- Last Synced: 2024-10-01T03:20:16.629Z (about 1 month ago)
- Topics: bash, install, shell, version, version-manager, zig, zsh
- Language: Shell
- Homepage:
- Size: 62.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Zig Upgrader and Version Manager
Upgrades to the latest version of Zig, or manages more versions of Zig on the same machine, supporting all platforms including RISC-V, as simple es `rustup`.
* Small. Written in `bash`, easily extensible.
* Fast. Downloads and unpacks pre-built binary builds.
* Portable. Writes only to the user home directory.
* Simple. Switches the version globally, no environment variable changes needed.
* Efficient. Just run `zigup up`.Platforms: `macos-x86_64`, `macos-aarch64`, `freebsd-x86_64`, `linux-x86`, `linux-x86_64`, `linux-aarch64`, `linux-armv7a`, `linux-powerpc64le`, `linux-riscv64`, `windows-x86`, `windows-x86_64`, `windows-aarch64`.
## Getting Started
Make sure that you have `bash` 4 or newer and `curl` available, execute the following command:
curl -fSs https://raw.githubusercontent.com/prantlf/zigup/master/install.sh | bash
Before you continue, make sure that you have the following tools available: `curl`, `grep`, `jq`, `ln`, `rm`, `rmdir`, `sed`, `tar` (non-Windows), `uname`, `unxz` (non-Windows), `unzip` (Windows). It's likely that `jq` will be missing. You can install it like this on Debian: `apt-get install -y jq`.
Install the latest version of Zig, if it hasn't been installed yet:
zigup install latest
Upgrade both the installer script and the Zig language, if they're not the latest versions, and delete the previously active latest version from the disk too:
zigup up
## Installation
Make sure that you have `bash` 4 or newer and `curl` available, execute the following command:
curl -fSs https://raw.githubusercontent.com/prantlf/zigup/master/install.sh | bash
Both the `zigup` and `zig` should be executable in any directory via the `PATH` environment variable. The installer script will modify the RC-file of the shell, from which you launched it. The following RC-files are supported:
~/.bashrc
~/.zshrc
~/.config/fish/config.fishIf you use other shell or more shells, update the other RC-files by putting both the installer directory and the Zig binary directory to `PATH`, for example:
$HOME/.zigup:$HOME/.zig:$PATH
Start a new shell after the installer finishes. Or extend the `PATH` in the current shell as the instructions on the console will tell you.
## Locations
| Path | Description |
|:-----------|:--------------------------------------------------------|
| `~/.zigup` | directory with the installer script and versions of Zig |
| `~/.zig` | symbolic link to the currently active version of Zig |For example, with the Zig 0.13.0 activated:
/home/prantlf/.zigup
├── 0.12.0 (another version)
├── 0.13.0 (linked to /home/prantlf/.zig)
└── zigup (installer script)## Usage
zigup [version]
Tasks:
current print the currently selected version of Zig
latest print the latest version of Zig for download
local print versions of Zig ready to be selected
remote print versions of Zig available for download
update update this tool to the latest version
upgrade upgrade Zig to the latest and remove the current version
up perform both update and upgrade tasks
install add the specified or the latest version of Zig
uninstall remove the specified version of Zig
use use the specified or the latest version of Zig
help print usage instructions for this tool
version print the version of this toolYou can enter just `MAJ` or `MAJ.MIN` as ``, instead of the full `MAJ.MIN.PAT`. When using the `install` or `use` tasks, the *most* recent full version that starts by the entered partial version will be picked. When using the `uninstall` task, the *least* recent full version that starts by the entered partial version will be picked.
## Debugging
If you enable `bash` debugging, every line of the script will be printed on the console. You'll be able to see values of local variables and follow the script execution:
bash -x zigup ...
You can debug the installer too:
curl -fSs https://raw.githubusercontent.com/prantlf/zigup/master/install.sh | bash -x
## Platform Detection
### Environment Variables
The following environment variables can be set before running `install.sh` or `zigup`, if you know what you're doing:
| Variable | Default value |
|:----------------|:----------------------------------------|
| `PLATFORM` | detected using `uname` |
| `OS` | part of `PLATFORM` before `-` |
| `ARCH` | part of `PLATFORM` after `-` |
| `TOOL_URL_LIST` | https://ziglang.org/download/index.json |
| `TOOL_URL_DIR` | https://ziglang.org/download |
| `INST_DIR` | `$HOME/.zigup` |
| `TOOL_DIR` | `$HOME/.zig` |## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.
## License
Copyright (c) 2024 Ferdinand Prantl
Licensed under the MIT license.