Welcome to my post about
swiftup, a command-line tool written in Swift that allows you to check the reachability of URLs in all the Swift files and packages within a directory, including any nested directories.
This tool is useful for verifying that the URLs referenced in your code are valid and accessible, ensuring that your projects are using reliable resources.
Before you can use
swiftup, you'll need to install it on your machine. Here's what you'll need to get started:
- Swift: Make sure you have the latest version of Swift installed on your machine. You can check this by running swift --version in the terminal.
Clone the repository:
git clone https://github.com/ishaanbedi/swiftup.git
Navigate to the repository directory:
Compile and install the tool:
swift build -c release
Move the binary file to a directory included in the system path:
mv .build/release/swiftup /usr/local/bin/swiftup
On macOS, the
/usr/local/bin directory is typically included in the default system path. On Linux, the recommended directory for system executables is
After moving the binary file to a directory that is included in your system path, you can use the swiftup command from any directory on your system. You may need to restart your terminal or log out and log back in for the changes to take effect.
Install using a single command
swiftup, compile the tool, and include it in the system path in a single command, run the following:
git clone https://github.com/ishaanbedi/swiftup.git && cd swiftup && swift build -c release; sudo mv .build/release/swiftup /usr/local/bin/swiftup
To fix the
permission denied error when executing the mv command, I've combined it with
sudo command to give the installation process superuser privileges.
If prompted for a password at this step, please enter the password for your user account on the machine.
On macOS, this will clone the repository, navigate to the repository directory, compile and install the tool, and move the binary file to the
/usr/local/bin directory, which is included in the default system path. On Linux, the command will be similar, but the binary file will be moved to the
/usr/bin directory instead.
swiftup is simple. Just run the command with any of the following optional arguments:
swiftup [-s START] [-h] [-v]
- -s START, --start START
- -h, --help: Show the help message and exit
- -v, --verbose: Enable verbose output
To check the reachability of URLs in all files in the current directory:
To check the reachability of URLs in all files in a specific directory:
swiftup -s /path/to/directory
Enabling verbose output will cause the tool to print more detailed information about the URLs it is checking and their reachability status. This can be helpful if you are trying to troubleshoot why a particular URL is not being reached, or if you simply want more insight into how the tool is functioning. To enable verbose output, you can use the
--verbose flag when running the swiftup command.
Please note that "swiftup" is a tool that only checks the reachability of URLs and does not validate their content or replace any occurrences of the URL. It is the responsibility of the end-user developer or user to ensure that any unreachable URLs reported by the tool are corrected and point to the intended resources.
swiftup simply provides a way to identify and flag any URLs that are not reachable, and it is up to the user to take the necessary steps to address any issues.
This project is licensed under the MIT license.
I hope you find
swiftup to be a useful tool for your projects.
Thank you for reading this far.