A cmw rewrite in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Elia el Lazkani 4ef54af009 Migrating to the new kingpin Envar() interface 1 year ago
LICENSE Adding the initial code 1 year ago
README.md Fixing transparency default value in README 1 year ago
main.go Migrating to the new kingpin Envar() interface 1 year ago
main_test.go Fixing unittest after the bugfix 1 year ago

README.md

Go CMW

go-cmw is a cmw rewrite in Go.

Usage

go-cmw features a good command-line interface thanks to kingpin.v2.

$ go-cmw --help
usage: go-cmw [<flags>]

A small terminal wrapper around the wttr.in weather endpoint.

Flags:
      --help                   Show context-sensitive help (also try --help-long and --help-man).
  -L, --location=LOCATION      Specify explicite location (--expert-mode)
  -l, --language=LANGUAGE      Specify explicite language (--expert-mode)
      --v2                     Display Data-Rich output
  -m, --metric                 Display weather in metric
  -u, --uscs                   Display weather in imperial
  -M, --meter-second           Display wind in m/s
  -z, --zero                   Display current weather
  -o, --one                    Display current weather + 1 day
  -w, --two                    Display current weather + 2 days
  -A, --ignore-user-agent      Ignore User-Agent and force ANSI output
  -F, --follow-link            Do not display the 'Follow' line
  -n, --narrow                 Display narrow view (only day/night)
  -q, --quiet                  Display quiet version (no weather report)
  -Q, --super-quiet            Display super quiet version (no weather report and no city)
  -N, --no-colors              Display no colors (always enabled on windows
  -P, --png                    Download a weather PNG image
  -p, --add-frame              Add a frame to the output (PNG only)
  -t, --transparency=255       Set transparency level (0-255) (PNG only) (--expert-mode)
  -d, --download               Enables download mode (--expert-mode)
      --file-name=""           Name download file (--expert-mode)
  -O, --one-liner              One liner outpet (for the terminal multiplexer lovers out there)
      --format=FORMAT          Specify a format query (e.g. "%l:+%c+%t") (--expert-mode)
      --free-style=FREE-STYLE  Specify a free-style API call (--expert-mode)
      --expert-mode            Print expert mode information
      --version                Show application version.

On top of the following command-line flags, go-cmw can also take advantage of environment variables --expert-mode.

$ go-cmw --zero
Weather report: Paris

     \   /     Clear
      .-.      1..4 °C        
   ― (   ) ―   ↗ 11 km/h      
      `-’      10 km          
     /   \     0.3 mm

go-cmw makes it easier to integrate the weather with your favorite terminal multiplexer.

$ go-cmw --one-liner
Paris: ☀️ +4°C

Example configuration for tmux.

# Let us update sensibly every 30 minutes
set -g status-interval 1800

WEATHER='#(go-cmw --one-liner)'
set -g status-right '... $WEATHER ...'

Expert Mode

The commands labeled --expert-mode have special functionality attached to them. Some of them can be used as environment variables while others override go-cmw default functionality to provide the user with more flexible interface.

For more information about commands labeled --expert-mode

$ go-cmw --expert-mode

Reason

This project is a journey of learning Golang. If you would like to make an MR, please go right ahead, it would be a good learning process for me.