go-cmw/README.md

89 lines
No EOL
3.2 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/).
# 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).
-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=0 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`.
```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 ...'
```
# 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`
```console
$ 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.