go-cmw/README.md
Elia el Lazkani cea7b560d0 Welcome the --one-liner flag, terminal multiplexer lovers
* Adding a new --one-liner flag that will return the weather on one line
* Updating README with usage and tmux configuration example
2020-02-27 00:15:41 +01:00

76 lines
No EOL
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Go CMW
`go-cmw` is a [cmw](https://gitlab.com/elazkani/cmw) rewrite in [Go](https://golang.org/).
# 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.
# Usage
`go-cmw` features a good command-line interface thanks to `kingpin.v2`.
```console
$ 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).
-m, --metric Display weather in metric
-u, --uscs Display weather in imperial
-M, --meter-second Display wind in m/s
-z, --zero Show the weather now
-o, --one Show the weather for one day
-w, --two Show the weather for two days
-A, --ignore-user-agent Request ignoring the user agent
-F, --follow-link Follow link redirect
-n, --narrow Display weather in narrow view
-q, --quiet Add the quiet flag
-Q, --super-quiet Add the super quiet flag
-N, --no-colors Disable displaying colors (always enabled on windows
-p, --add-frame Add a frame to the output
-T, --mid-transparency Enable mid-transparency (PNG only)
-P, --png Download a weather PNG image
--v2 Use the v2 endpoint
-t, --transparency=0 Set transparency level (0-100) (PNG only)
-f, --format=FORMAT Query format (overrides everything else)
-L, --location=LOCATION Specify explicite location
-l, --language=LANGUAGE Specify explicite language
-O, --one-liner One liner outpet (for the terminal multiplexer lovers out there)
--extra-information Print extra information
--version Show application version.
```
On top of the following command-line flags, `go-cmw` can also take advantage of environment variables.
`go-cmw` can take advantage of `GO_CMW_FORMAT`, `GO_CMW_LOCATION` and `GO_CMW_LANGUAGE` environment variables if set.
```console
$ 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.
```console
$ go-cmw --one-liner
Paris: ☀️ +4°C
```
Example configuration for `tmux`.
```console
# Let us update sensibly every 30 minutes
set -g status-interval 1800
WEATHER='#(go-cmw --one-liner)'
set -g status-right '... $WEATHER ...'
```