はじめに
前回同様、brew
で入れられる面白いソフトはないかなーと思って調べてみた。
適当に見てみると、ansiweather
というソフトで天気予報が見られるらしいので試してみる。
環境
MacOS Ventura 13.3.1
Homebrew 4.1.14
ansiweatherのインストール
brew install ansiweather
~/workspace/blog-hugo$brew install ansiweather
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ansiweather/manifests/1.19.0
############################################################################################################################################### 100.0%
==> Fetching dependencies for ansiweather: jq
==> Downloading https://ghcr.io/v2/homebrew/core/jq/manifests/1.7
############################################################################################################################################### 100.0%
==> Fetching jq
==> Downloading https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:e4b23ebcff759f57e62e2573359ccb62e8e3426a1237082bf3301843230d3094
############################################################################################################################################### 100.0%
==> Fetching ansiweather
==> Downloading https://ghcr.io/v2/homebrew/core/ansiweather/blobs/sha256:0c1bc49161f466ba2c18219918f324c2aa22e63b0e1078e275d1832f1c349e2f
############################################################################################################################################### 100.0%
==> Installing dependencies for ansiweather: jq
==> Installing ansiweather dependency: jq
==> Downloading https://ghcr.io/v2/homebrew/core/jq/manifests/1.7
Already downloaded: /Users/horibahiroto/Library/Caches/Homebrew/downloads/f58ea096b48ef3cd8719cb0ec4581f6929b3c5fa4340fd648205306f0e6fab49--jq-1.7.bottle_manifest.json
==> Pouring jq--1.7.ventura.bottle.tar.gz
🍺 /usr/local/Cellar/jq/1.7: 19 files, 1.3MB
==> Installing ansiweather
==> Pouring ansiweather--1.19.0.all.bottle.tar.gz
🍺 /usr/local/Cellar/ansiweather/1.19.0: 8 files, 28.3KB
==> Running `brew cleanup ansiweather`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
OK
使ってみる
まずは man
で使い方を見てみる。
ANSIWEATHER(1) General Commands Manual ANSIWEATHER(1)
NAME
ansiweather – weather in terminal, with ANSI colors and Unicode symbols
SYNOPSIS
ansiweather [-l location] [-u system] [-f days] [-F] [-a value] [-s value] [-k key] [-i value] [-w value] [-h value] [-H value] [-p value]
[-d value] [-v]
DESCRIPTION
ansiweather is a shell script for displaying the current weather conditions in a terminal, with support for ANSI colors and Unicode symbols.
Weather data comes from the OpenWeatherMap free weather API.
The options are as follows:
-l location
Specify location.
-u system
Specify unit system to use ( metric or imperial ).
-f days
Toggle forecast mode for the specified number of upcoming days.
-F Toggle forecast mode for the next five days.
-a value
Toggle ANSI colors display ( true or false ).
-s value
Toggle symbols display ( true or false ).
-k key Specify OpenWeatherMap API key.
-i value
Toggle UV Index display ( true or false ).
-w value
Toggle wind data display ( true or false ).
-h value
Toggle humidity data display ( true or false ).
-H value
Toggle Feels like display ( true or false ).
-p value
Toggle pressure data display ( true or false ).
-d value
Toggle daylight data display ( true or false ).
-v Display version.
EXAMPLES
Display forecast using metric units for the next five days (showing symbols and daylight data) for Rzeszow, Poland:
ansiweather -l "Rzeszow,PL" -u metric -s true -f 5 -d true
AUTHORS
ansiweather was written by Frederic Cambus.
macOS 13.3
東京の天気を調べてみる。
ansiweather -l Tokyo
$ ansiweather -l Tokyo
Weather in Tokyo: 24 °C - UVI: 6 - Wind: 8.75 m/s NNW - Humidity: 31% - Pressure: 1013 hPa
おぉ出てくる。
東京の5日間の天気を見てみる。-F
で天気の記号が出てくる。
↓
~/workspace/blog-hugo$ansiweather -l Tokyo -s true -F
Tokyo forecast: 土 10 07: 24/18 °C ☁ - 日 10 08: 23/18 °C ☔ - 月 10 09: 18/15 °C ☔ - 火 10 10: 26/18 °C ☔ - 水 10 11: 23/18 °C ☁
おぉ、面白い。
おわりに
天気予報はブラウザ開いて調べるのは面倒くさいし、デスクトップに表示させるのも一回見ればいいしという感じなので、コマンドで見れるのはちょっと便利かも。