Flist CLI in Vlang

Table of Contents

- [Introduction](#introduction) - [Installation](#installation) - [Prerequisites](#prerequisites) - [Building and Installing](#building-and-installing) - [Rebuilding and Uninstalling](#rebuilding-and-uninstalling) - [Available Commands](#available-commands) - [Usage](#usage) - [OS-Specific Instructions](#os-specific-instructions) - [Linux](#linux) - [macOS](#macos) - [Windows](#windows) - [Troubleshooting](#troubleshooting) - [Development](#development) - [Contributing](#contributing) - [License](#license) --- ## Introduction Flist CLI is a tool that turns Dockerfiles and Docker images directly into Flist on the TF Flist Hub, passing through Docker Hub. ## Installation ### Prerequisites - [V programming language](https://vlang.io/) (latest version) installed on your system - [Docker Engine](https://docs.docker.com/engine/install/) installed and running (Linux) - [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running (MacOS+Windows) - [Docker Hub](https://hub.docker.com/) account - [TF Hub](https://hub.grid.tf/) account and token Read more on the TF Hub and Flist on the ThreeFold Manual [here](https://manual.grid.tf/documentation/developers/flist/flist.html). ### Building and Installing - To clone this repository, build the project, and install the CLI: - MacOS and Linux ``` git clone https://git.ourworld.tf/tfgrid/flist_cli_v cd flist_cli_v make build ``` - Windows ``` git clone https://git.ourworld.tf/tfgrid/flist_cli_v cd flist_cli_v make build-win ``` This will build the executable and install it to the appropriate system location. ### Rebuilding and Uninstalling You can use the following Makefile commands: - To rebuild and reinstall: - MacOS and Linux ``` make rebuild ``` - Windows ``` make rebuild-win ``` - To uninstall and remove the binary: - MacOS and Linux ``` make delete ``` - Windows ``` make delete-win ``` ## Available Commands After installation, you can use the `flist` command followed by various subcommands: ``` flist [arguments] ``` Run `flist` or `flist help` to see all available commands for your specific OS. - `install` - Install the Flist CLI - `uninstall` - Uninstall the Flist CLI - `login` - Log in to Docker Hub and save the Flist Hub token - `logout` - Log out of Docker Hub and remove the Flist Hub token - `push` - Build and push a Docker image to Docker Hub, then convert and push it as an Flist to Flist Hub - `delete` - Delete an Flist from Flist Hub - `rename` - Rename an Flist in Flist Hub - `ls` - List all Flists of the current user - `ls url` - List all Flists of the current user with full URLs - `help` - Display this help message ## Usage A Linux user would use the following commands: ``` sudo ./flist install sudo flist uninstall flist login flist logout flist push : flist delete flist rename flist ls flist ls url flist help ``` ## OS-Specific Instructions ### Linux 1. Ensure Docker Engine is installed and running. 2. The `flist` executable will be installed to: ``` /usr/local/bin/flist ``` ### macOS 1. Ensure Docker Desktop is installed and running. 2. The `flist` executable will be installed to: ``` /usr/local/bin/flist ``` ### Windows 1. Ensure Docker Desktop is installed and running. 2. Run the program and installer in an admin PowerShell. 3. The `flist.exe` executable will be installed to: ``` C:\\Program Files\\flist\\flist.exe ``` ## Troubleshooting - If you encounter permission issues, ensure you're running the command with appropriate privileges (e.g., as administrator on Windows or with `sudo` on Unix-like systems). - If you face issues with Docker commands, try logging out and logging back in to refresh your Docker credentials. - If you encounter compilation errors, ensure you have the latest version of V installed. To update v, run `v up`. ## Development To modify the Flist CLI: 1. Make your changes to the `flist.v` file. 2. Rebuild the project using using the appropriate Make command. 3. Test your changes thoroughly across different operating systems if possible. ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. ## License [Apache 2.0 License](LICENSE)