欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

c++ 从命令行获取参数_从命令行获取天气

程序员文章站 2022-05-23 23:51:18
...

c++ 从命令行获取参数

There's an awesome script making the rounds on Twitter and I've been as excited as everyone else so I thought I'd show it.  Many of us live eight hours a day within the command line (although I'm not a vim hippie like some of you) so I try to find new ways to accomplish tasks from within iTerm (like getting bitcoin value or stock quotes).  Many of these solutions include using cURL and this awesomeness is no exception!

Twitter上有一个很棒的脚本来回合,我和其他所有人一样兴奋,所以我想展示一下。 我们中的许多人每天都在命令行中生活8个小时(尽管我不像你们中的某些人那样活跃),所以我尝试寻找新的方法来完成iTerm中的任务(例如获得比特币价值股票报价 )。 这些解决方案中的许多解决方案都包括使用cURL,这一点也不例外!

c++ 从命令行获取参数_从命令行获取天气

You can get weather information from command line using cURL and wttr.in:

您可以使用cURL和wttr.in从命令行获取天气信息:


# Allow geolocation
curl -4 wttr.in

# Request a city
curl -4 wttr.in/Madison


wttr.in does well to guess location if one isn't provided so in most cases you wont need to provide your city.

wttr.in很容易猜测是否未提供位置,因此在大多数情况下,您不需要提供城市。

There you go, another awesome way to get the information you need from command line!

到这里,从命令行获取所需信息的另一种很棒的方法!

翻译自: https://davidwalsh.name/get-weather-command-line

c++ 从命令行获取参数