Package Exports
- @jamesukiyo/sunny-cli
- @jamesukiyo/sunny-cli/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jamesukiyo/sunny-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
⛅ sunny-rs ⛅
A simple weather app for your terminal, written in Rust.
Features
- check the weather for any city today or tomorrow
- fast (~130ms with fetch, sunny itself only takes 0.5 to 3ms depending on output style)
- 3 output styles: fancy, simple, raw
- fahrenheit support
- emojis or nerd font icons if supported
- true colour output if supported
- toml config file
- install from multiple package managers
Usage
Install
With cargo:
cargo install sunny-cliWith npm/bun/pnpm:
npm install -g @jamesukiyo/sunny-cli
bun install -g @jamesukiyo/sunny-cli
pnpm install -g @jamesukiyo/sunny-cliWith scoop:
scoop bucket add jamesukiyo https://github.com/jamesukiyo/sunny-rs
scoop install sunny-cliWith homebrew:
brew install jamesukiyo/sunny-rs/sunny-cliSetup
You will need a free API key from OpenWeatherMap.
A nerd font and terminal that supports emojis and true colour is recommended (see below).
See the #run section for info on how to use sunny.
Config
A config file is created on first run at $HOME/.config/sunny.toml.
Inside it you can set the following:
city: the city to get the weather for [default: ""]api_key: your API key for OpenWeatherMap [default: ""]use_fahrenheit: whether to use fahrenheit for temperature [default: false]show_footer: whether to show the footer [default: true]show_header: whether to show the header [default: true]icons: whether to enable nerd font and emoji icons [default: true]colours: whether to enable colors [default: true]
[!IMPORTANT] If icons are enabled, an emoji is tried first if supported and then a nerd font icon. If neither work, the layout may be incorrect so try disabling icons or using a nerd font.
If colours are enabled, the terminal must support true colour. If not, the output will be incorrect so try disabling colours.
See example_config.toml for an example.
[!TIP] CLI arguments can and will override corresponding config values.
I recommend using the config file. Then you can run sunny without any
arguments and see the weather quickly for today.
It's also easier to override the city this way but still have a good default.
sunny # uses your default city
sunny paris # allows overrideRun
For cargo and scoop installations:
sunny # today (city in config)
sunny t # tomorrow (city in config)
sunny paris # today in paris
sunny tomorrow paris # tomorrow in paris
sunny paris --simple # today in paris, simple output
sunny t paris --simple # tomorrow in paris, simple outputFor npm/bun/pnpm installations prefix with your package managers executor:
npx sunny
bunx sunny
pnpx sunnyFull help:
Usage: sunny [OPTIONS] [CITY] [COMMAND]
Commands:
today Get today's weather (default)
tomorrow Get tomorrow's weather
t Short alias for tomorrow
help Print this message or the help of the given subcommand(s)
Arguments:
[CITY] City to get the weather for [default: ]
Options:
-s, --simple Simpler output (no styling)
-r, --raw Raw JSON output
-k, --key <KEY> API key for OpenWeatherMap [default: ]
-f, --fahrenheit Use fahrenheit for temperature
-F, --no-footer Hide the credits footer from output
-H, --no-header Hide the header from output
-c, --no-colors Disable colors - good for terminals without true colour support
-C, --clean Alias for --no-header --no-footer
-i, --no-icons Disable icons - good for non-nerd fonts or lack of emoji support
-h, --help Print helpLicense
Copyright (c) James Plummer jamesp2001@live.co.uk
This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT)