🌦️ Fast and simple CLI tool for fetching weather data from different weather API providers 🌏
Weather-rs is a lightweight command-line tool designed to quickly fetch weather data from various API providers. It offers a convenient way to check the weather conditions for a specific location, providing real-time and historical data.
- Installation
- Usage
- Configuration
- Features
- Supported Weather API Service Providers
- Contributing
- Authors
- Alternatives
- License
You can download pre-compiled binaries from the Release Section.
-
Install Rust and Cargo from the official website: Rust Installation.
-
Run the following command to install and compile
weather-rs
:cargo install weather-rs --git 'https://github.com/XNM1/weather-rs'
-
Add the
.cargo/bin
directory to your PATH environment variable in your shell or use it directly from the.cargo/bin
directory.-
Fish Shell:
set -gx PATH $HOME/.cargo/bin $PATH
-
Bash or Zsh:
export PATH="$HOME/.cargo/bin:$PATH"
You can use the following commands in the shell for one-time use. Alternatively, you can set them in the appropriate shell configuration file to ensure they persist even after a shell restart. You can now use Cargo binaries seamlessly from the command line without specifying the full path to the
.cargo/bin
directory. -
-
Clone the project from GitHub using the following command:
git clone https://github.com/XNM1/weather-rs
-
Navigate to the cloned project folder:
cd weather-rs
-
Build the project using Nix:
nix build
-
Install the project using Nix Package Manager:
nix-env -i ./result
-
Clone the project from GitHub using the following command:
git clone 'https://github.com/XNM1/weather-rs'
-
Navigate to the cloned project folder and build the project with the following command:
cargo build --release
-
You can find the executable binary in
weather-rs/target/release
calledweather-rs
.
Fast and simple CLI tool for weather data fetching from different providers
Usage: weather-rs <COMMAND>
Commands:
provider-list Get a full list of supported providers
configure Configure a provider with the given credentials
select-provider Select an available provider
get Get weather information
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
-
Check available weather provider APIs using the command:
weather-rs provider-list
-
Configure weather providers using the command:
weather-rs configure <PROVIDER> <API_KEY> [-u <URL>]
Example:
weather-rs configure 'open-weather' '<your api key>'
-
Select a provider using the command:
weather-rs select-provider <PROVIDER>
Example:
weather-rs select-provider 'weather-api'
-
Get information about weather data using the command:
weather-rs get <ADDRESS> [-d <DATE>] [--json] [-p <PROVIDER>]
Example:
weather-rs get 'London'
Another example:
weather-rs get 'London' -d '2023-10-11' --json
The configuration file is located in the following directories:
- Linux:
~/.config/weather-rs/config.toml
- MacOS:
~/Library/Preferences/weather-rs/config.toml
- Windows:
%USERPROFILE%\AppData\Roaming\weather-rs\config\config.toml
The configuration file is in TOML format and includes settings for services (URL and API key). For example:
[open_weather]
url = 'https://api.openweathermap.org/data/2.5/weather'
api_key = 'your_api_key_here'
You can also set the selected main weather data provider in the selected_provider
parameter. Example:
selected_provider = 'OpenWeather'
Please note that the selected provider should be in PascalCase in configuration file and in kebab-case when set from the command line (e.g., weather-rs select-provider 'open-weather'
).
🌟 Simple and minimal
🚀 Very fast
🛡️ Safe (written in safe Rust 🦀)
📋 Supports output in JSON format for your scripts and tabular format for a more visually pleasing display
🌍 Supports different weather API service providers
At the moment, the project supports two providers:
-
Open Weather API version 2: https://api.openweathermap.org/data/2.5/weather (provides current weather data).
-
Weather API version 1: https://api.weatherapi.com/v1 (provides current and historical weather data).
More providers may be added in the future.
Contributions are welcome! Please refer to the CONTRIBUTING.md file for more information on contribution guidelines.
If you're interested in other weather-related CLI tools, consider checking out these alternatives:
- wthrr - Weather companion for the terminal.
- wttr - The right way to check the weather.
- weather - Weather via the command line.
- weather-api - A RESTful API to check the weather.
This project is licensed under the MIT license. For more details, please refer to the LICENSE file. 📜