translated

This commit is contained in:
geekpi 2018-07-27 08:55:20 +08:00
parent defa7105d8
commit af52fe7ebc
2 changed files with 118 additions and 119 deletions

View File

@ -1,119 +0,0 @@
translating---geekpi
Display Weather Forecast In Your Terminal With Wttr.in
======
**[wttr.in][1] is a feature-packed weather forecast service that supports displaying the weather from the command line**. It can automatically detect your location (based on your IP address), supports specifying the location or searching for a geographical location (like a site in a city, a mountain and so on), and much more. Oh, and **you don't have to install it - all you need to use it is cURL or Wget** (see below).
wttr.in features include:
* **displays the current weather as well as a 3-day weather forecast, split into morning, noon, evening and night** (includes temperature range, wind speed and direction, viewing distance, precipitation amount and probability)
* **can display Moon phases**
* **automatic location detection based on your IP address**
* **allows specifying a location using the city name, 3-letter airport code, area code, GPS coordinates, IP address, or domain name**. You can also specify a geographical location like a lake, mountain, landmark, and so on)
* **supports multilingual location names** (the query string must be specified in Unicode)
* **supports specifying the language** in which the weather forecast should be displayed in (it supports more than 50 languages)
* **it uses USCS units for queries from the USA and the metric system for the rest of the world** , but you can change this by appending `?u` for USCS, and `?m` for the metric system (SI)
* **3 output formats: ANSI for the terminal, HTML for the browser, and PNG**.
Like I mentioned in the beginning of the article, to use wttr.in, all you need is cURL or Wget, but you can also
**Before using wttr.in, make sure cURL is installed.** In Debian, Ubuntu or Linux Mint (and other Debian or Ubuntu-based Linux distributions), install cURL using this command:
```
sudo apt install curl
```
### wttr.in command line examples
Get the weather for your location (wttr.in tries to guess your location based on your IP address):
```
curl wttr.in
```
Force cURL to resolve names to IPv4 addresses (in case you're having issues with IPv6 and wttr.in) by adding `-4` after `curl` :
```
curl -4 wttr.in
```
**Wget also works** (instead of cURL) if you want to retrieve the current weather and forecast as a png, or if you use it like this:
```
wget -O- -q wttr.in
```
You can replace `curl` with `wget -O- -q` in all the commands below if you prefer Wget over cURL.
Specify the location:
```
curl wttr.in/Dublin
```
Display weather information for a landmark (the Eiffel Tower in this example):
```
curl wttr.in/~Eiffel+Tower
```
Get the weather information for an IP address' location (the IP below belongs to GitHub):
```
curl wttr.in/@192.30.253.113
```
Retrieve the weather using USCS units:
```
curl wttr.in/Paris?u
```
Force wttr.in to use the metric system (SI) if you're in the USA:
```
curl wttr.in/New+York?m
```
Use Wget to download the current weather and 3-day forecast as a PNG image:
```
wget wttr.in/Istanbul.png
```
You can specify the PNG
**For many other examples, check out the wttr.in[project page][2] or type this in a terminal:**
```
curl wttr.in/:help
```
--------------------------------------------------------------------------------
via: https://www.linuxuprising.com/2018/07/display-weather-forecast-in-your.html
作者:[Logix][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/118280394805678839070
[1]:https://wttr.in/
[2]:https://github.com/chubin/wttr.in
[3]:https://github.com/chubin/wttr.in#installation
[4]:https://github.com/schachmat/wego
[5]:https://github.com/chubin/wttr.in#supported-formats

View File

@ -0,0 +1,118 @@
使用 Wttr.in 在你的终端中显示天气预报
======
**[wttr.in][1] 是一个功能丰富的天气预报服务,它支持在命令行显示天气**。它可以自动检测你的位置(根据你的 IP 地址),支持指定位置或搜索地理位置(如城市、山区等)等。哦,另外**你不需要安装它 - 你只需要使用 cURL 或 Wget**(见下文)。
wttr.in 功能包括:
* **显示当前天气以及 3 天天气预报,分为早晨、中午、傍晚和夜晚**(包括温度范围、风速和风向、可见度、降水量和概率)
* **可以显示月相**
* **基于你的 IP 地址自动检测位置**
* **允许指定城市名称、3 字母的机场代码、区域代码、GPS 坐标、IP 地址或域名**。你还可以指定地理位置,如湖泊、山脉、地标等)
* **支持多语言位置名称**(查询字符串必须以 Unicode 指定)
* **支持指定**天气预报显示的语言(它支持超过 50 种语言)
* **it uses USCS units for queries from the USA and the metric system for the rest of the world** , but you can change this by appending `?u` for USCS, and `?m` for the metric system (SI)
* **来自美国的查询使用 USCS 单位用于,世界其他地方使用公制系统**,但你可以通过附加 `?u` 使用 USCS附加 `?m` 使用公制系统。
* **3 种输出格式:终端的 ANSI浏览器的 HTML 和 PNG**。
就像我在文章开头提到的那样,使用 wttr.in你只需要 cURL 或 Wget但你也可以
**在使用 wttr.in 之前,请确保已安装 cURL。**在 Debian、Ubuntu 或 Linux Mint以及其他基于 Debian 或 Ubuntu 的 Linux 发行版)中,使用以下命令安装 cURL
```
sudo apt install curl
```
### wttr.in 命令行示例
获取你所在位置的天气wttr.in 会根据你的 IP 地址猜测你的位置):
```
curl wttr.in
```
通过在 `curl` 之后添加 `-4`,强制 cURL 将名称解析为 IPv4 地址(如果你遇到 IPv6 和 wttr.in 问题):
```
curl -4 wttr.in
```
如果你想检索天气预报保存为 png**还可以使用 Wget**(而不是 cURL或者你想这样使用它
```
wget -O- -q wttr.in
```
如果相对 cURL 你更喜欢 Wget ,可以在下面的所有命令中用 `wget -O- -q` 替换 `curl`
指定位置:
```
curl wttr.in/Dublin
```
显示地标的天气信息(本例中为艾菲尔铁塔):
```
curl wttr.in/~Eiffel+Tower
```
获取 IP 地址位置的天气信息(以下 IP 属于 GitHub
```
curl wttr.in/@192.30.253.113
```
使用 USCS 单位检索天气:
```
curl wttr.in/Paris?u
```
如果你在美国,强制 wttr.in 使用公制系统SI
```
curl wttr.in/New+York?m
```
使用 Wget 将当前天气和 3 天预报下载为 PNG 图像:
```
wget wttr.in/Istanbul.png
```
你可以指定 PNG 名称
**对于其他示例,请查看 wttr.in [项目页面][2]或在终端中输入:**
```
curl wttr.in/:help
```
--------------------------------------------------------------------------------
via: https://www.linuxuprising.com/2018/07/display-weather-forecast-in-your.html
作者:[Logix][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://plus.google.com/118280394805678839070
[1]:https://wttr.in/
[2]:https://github.com/chubin/wttr.in
[3]:https://github.com/chubin/wttr.in#installation
[4]:https://github.com/schachmat/wego
[5]:https://github.com/chubin/wttr.in#supported-formats