命令行中的世界杯
足球 比赛
![](/data/attachment/album/201807/04/214729riril1v7egmtxklg.jpg)


足球始终在我们身边。即使我们国家的队伍已经出局（LCTT 译注：显然这不是指我们国家，因为我们根本没有入局……），我还是想知道球赛比分。目前， 国际足联世界杯是世界上最大的足球锦标赛，2018 届是由俄罗斯主办的。每届世界杯都有一些足球强国未能取得参赛资格（LCTT 译注：我要吐槽么？）。意大利和荷兰就无缘本次世界杯。但是即使在未参加比赛的国家，追踪关注最新比分也成为了一种仪式。我希望能及时了解这个世界级的重大赛事最新比分的变化，而不用去搜索不同的网站。


如果你很喜欢命令行，那么有更好的方法用一个小型命令行程序追踪最新的世界杯比分和排名。让我们看一看最热门的可用的球赛趋势分析程序之一，它叫作 football-cli。


football-cli 不是一个开创性的应用程序。这几年，有许多命令行工具可以让你了解到最新的球赛比分和赛事排名。例如，我是 soccer-cli （Python 写的）和 App-football （Perl 写的）的重度用户。但我总是在寻找新的趋势分析应用，而 football-cli 在某些方面脱颖而出。


football-cli 是 JavaScript 开发的，由 Manraj Singh 编写，它是开源的软件。基于 MIT 许可证发布，用 npm（JavaScript 包管理器）安装十分简单。那么，让我们直接行动吧！


该应用程序提供了命令以获取过去及现在的赛事得分、查看联赛和球队之前和将要进行的赛事。它也会显示某一特定联赛的排名。有一条指令可以列出程序所支持的不同赛事。我们不妨从最后一个条指令开始。


在 shell 提示符下：



```
luke@ganges:~$ football lists

```

![球赛列表](/data/attachment/album/201807/04/214730tre5a4elb5bzrmg5.png)


世界杯被列在最下方，我错过了昨天的比赛，所以为了了解比分，我在 shell 提示下输入：



```
luke@ganges:~$ football scores

```

![football-wc-22](/data/attachment/album/201807/04/214731nup5t510qb5z0pyy.png)


现在，我想看看目前的世界杯小组排名。很简单：



```
luke@ganges:~$ football standings -l WC

```

下面是输出的一个片段：


![football-wc-biaoge](/data/attachment/album/201807/04/214735xuhewryhhrs0haar.png)


你们当中眼尖的可能会注意到这里有一个错误。比如比利时看上去领先于 G 组，但这是不正确的，比利时和英格兰（截稿前）在得分上打平。在这种情况下，纪律好的队伍排名更高。英格兰收到两张黄牌，而比利时收到三张，因此，英格兰应当名列榜首。


假设我想知道利物浦 90 天前英超联赛的结果，那么:



```
luke@ganges:~$ football fixtures -l PL -d 90 -t "Liverpool"

```

![足球-利物浦](/data/attachment/album/201807/04/214737tpi7rp2pvk7vs2s7.png)


我发现这个程序非常方便。它用一种清晰、整洁而有吸引力的方式显示分数和排名。当欧洲联赛再次开始时，它就更有用了。（事实上 2018-19 冠军联赛已经在进行中）！


这几个示例让大家对 football-cli 的实用性有了更深的体会。想要了解更多，请转至开发者的 [GitHub 页面](https://github.com/ManrajGrover/football-cli)。足球 ＋ 命令行 ＝ football-cli。


如同许多类似的工具一样，该软件从 football-data.org 获取相关数据。这项服务以机器可读的方式为所有欧洲主要联赛提供数据，包括比赛、球队、球员、结果等等。所有这些信息都是以 JOSN 形式通过一个易于使用的 RESTful API 提供的。




---


via: <https://www.linuxlinks.com/football-cli-world-cup-football-on-the-command-line/>


作者：[Luke Baker](https://www.linuxlinks.com/author/luke-baker/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[ZenMoore](https://github.com/ZenMoore) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Last Updated on September 1, 2020

Football is around us constantly. Even when domestic leagues have finished, there’s always a football score I want to know. Currently, it’s the biggest football tournament in the world, the Fifa World Cup 2018, hosted in Russia. Every World Cup there are some great football nations that don’t manage to qualify for the tournament. This time around the Italians and the Dutch missed out. But even in non-participating countries, it’s a rite of passage to keep track of the latest scores. I also like to keep abreast of the latest scores from the major leagues around the world without having to search different websites.

If you’re a big fan of the command-line, what better way to keep track of the latest World Cup scores and standings with a small command-line utility. Let’s take a look at one of the hottest trending football utilities available. It’s goes by the name football-cli.


football-cli is not a groundbreaking app. Over the years, there’s been a raft of command line tools that let you keep you up-to-date with the latest football scores and league standings. For example, I am a heavy user of soccer-cli, a Python based tool, and App-Football, written in Perl. But I’m always looking on the look out for trending apps. And football-cli stands out from the crowd in a few ways.

football-cli is developed in JavaScript and written by Manraj Singh. It’s open source software, published under the MIT license. Installation is trivial with npm (the package manager for JavaScript), so let’s get straight into the action.

The utility offers commands that give scores of past and live fixtures, see upcoming and past fixtures of a league and team. It also displays standings of a particular league. There’s a command that lists the various supported competitions. Let’s start with the last command.

At a shell prompt.

The World Cup is listed at the bottom. I missed yesterday’s games, so to catch up on the scores, I type at a shell prompt:

Now I want to see the current World Cup group standings. That’s easy.

Here’s an excerpt of the output:

The eagle-eyed among you may notice a bug here. Belgium is showing as the leader of Group G. But this is not correct. Belgium and England are (at the time of writing) both tied on points, goal difference, and goals scored. In this situation, the team with the better disciplinary record is ranked higher. England and Belgium have received 2 and 3 yellow cards respectively, so England top the group.

Suppose I want to find out Liverpool’s results in the Premiership going back 90 days from today.

I’m finding the utility really handy, displaying the scores and standings in a clear, uncluttered, and attractive way. When the European domestic games start up again, it’ll get heavy usage. (Actually, the 2018-19 Champions League is already underway)!

These few examples give a taster of the functionality available with football-cli. Read more about the utility from the developer’s ** GitHub page. ** Football + command-line = football-cli

Like similar tools, the software retrieves its football data from football-data.org. This service provide football data for all major European leagues in a machine-readable way. This includes fixtures, teams, players, results and more. All this information is provided via an easy-to-use RESTful API in JSON representation.

football-cli is written in JavaScript. Learn JavaScript with our recommended ** free books** and

**.**

[free tutorials](/excellent-free-tutorials-learn-javascript/)Popular series |
|
---|---|

![]() |


[in the universe. Each article is supplied with a legendary ratings chart helping you to make informed decisions.](/best-free-open-source-software/)**best free and open source software**![Reviews](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/reviews-icon-48px.png?resize=48%2C48&ssl=1)

![Reviews](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/reviews-icon-48px.png?resize=48%2C48&ssl=1)

[offering our unbiased and expert opinion on software. We offer helpful and impartial information.](/category/reviews/)**in-depth reviews**![](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2024/09/012-pc.png?resize=48%2C48&ssl=1)

![](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2024/09/012-pc.png?resize=48%2C48&ssl=1)

[is a large compilation of actively developed Linux distributions.](/big-list-linux-distros/)**The Big List of Active Linux Distros**![Alternatives to Proprietary Software](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/alternatives-icon-48px.png?resize=48%2C48&ssl=1)

![Alternatives to Proprietary Software](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/alternatives-icon-48px.png?resize=48%2C48&ssl=1)

[,](/best-free-open-source-alternatives-google-products-services/)**Google**[,](/best-free-open-source-alternatives-microsoft-products-services/)**Microsoft**[,](/best-free-open-source-alternatives-apple-products/)**Apple**[,](/best-free-open-source-alternatives-adobe-creative-cloud/)**Adobe**[,](/best-free-open-source-alternatives-ibm-products/)**IBM**[,](/best-free-open-source-alternatives-autodesk-products/)**Autodesk**[,](/best-free-open-source-alternatives-oracle-products/)**Oracle**[,](/best-free-open-source-alternatives-atlassian-products/)**Atlassian**[,](best-free-open-source-alternatives-corel-products)**Corel**[,](/best-free-open-source-alternatives-cisco-products/)**Cisco**[, and](/best-free-open-source-alternatives-intuit-products/)**Intuit**[.](/best-free-open-source-alternatives-sas-products/)**SAS**![Games](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/04/games-joystick-icon-48px.png?resize=48%2C48&ssl=1)

![Games](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/04/games-joystick-icon-48px.png?resize=48%2C48&ssl=1)

[showcases a series of tools that making gaming on Linux a more pleasurable experience. This is a new series.](/awesome-free-linux-game-tools/)**Awesome Free Linux Games Tools**![Artificial intelligence icon](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2023/02/006-artificial-intelligence.png?resize=48%2C48&ssl=1)

![Artificial intelligence icon](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2023/02/006-artificial-intelligence.png?resize=48%2C48&ssl=1)

[explores practical applications of machine learning and deep learning from a Linux perspective. We've written reviews of more than 40 self-hosted apps. All are free and open source.](/machine-learning-linux/)**Machine Learning**![Guide to Linux](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/new-linux-icon-48px.png?resize=48%2C48&ssl=1)

![Guide to Linux](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/new-linux-icon-48px.png?resize=48%2C48&ssl=1)

[. We start right at the basics and teach you everything you need to know to get started with Linux.](/linux-starters-guide-introduction/)**Linux for Starters series**![](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2023/04/022-information.png?resize=48%2C48&ssl=1)

![](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2023/04/022-information.png?resize=48%2C48&ssl=1)

[showcases essential tools that are modern replacements for core Linux utilities.](/alternatives-popular-cli-tools/)**Alternatives to popular CLI tools**![System Tools](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/system-tools-icon-48px.png?resize=48%2C48&ssl=1)

![System Tools](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/system-tools-icon-48px.png?resize=48%2C48&ssl=1)

[focuses on small, indispensable utilities, useful for system administrators as well as regular users.](/essential-system-tools-excellent-ways-manage-system/)**Essential Linux system tools**![Productivity](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/productivity-improve-icon-48px.png?resize=48%2C48&ssl=1)

![Productivity](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/productivity-improve-icon-48px.png?resize=48%2C48&ssl=1)

[. Small, indispensable tools, useful for anyone running a Linux machine.](/outstanding-linux-utilities-maximize-productivity/)**productivity**![Audio](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/09/audio-cloud-service.png?resize=48%2C48&ssl=1)

![Audio](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/09/audio-cloud-service.png?resize=48%2C48&ssl=1)

[,](/streaming-linux-amazon-music-unlimited/)**Amazon Music Unlimited**[,](/streaming-linux-myuzi/)**Myuzi**[,](/streaming-linux-spotify/)**Spotify**[,](/streaming-linux-deezer/)**Deezer**[.](/streaming-linux-tidal/)**Tidal**![Saving Money with Linux](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/09/026-budgeting.png?resize=48%2C48&ssl=1)

![Saving Money with Linux](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/09/026-budgeting.png?resize=48%2C48&ssl=1)

[looks at how you can reduce your energy bills running Linux.](/saving-money-linux-getting-started/)**Saving Money with Linux**![Home Computers](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/home-computer-icon-48px.png?resize=48%2C48&ssl=1)

![Home Computers](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/home-computer-icon-48px.png?resize=48%2C48&ssl=1)

[including the Commodore 64, Amiga, Atari ST, ZX81, Amstrad CPC, and ZX Spectrum.](/emulate-sinclair-zx81-home-computer-linux/)**Emulate home computers**![Now and Then](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/now-and-then-icon-48px.png?resize=48%2C48&ssl=1)

![Now and Then](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/now-and-then-icon-48px.png?resize=48%2C48&ssl=1)

[examines how promising open source software fared over the years. It can be a bumpy ride.](/what-happened-three-promising-open-source-linux-terminal-emulators/)**Now and Then**![Linux at Home](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/linux-at-home-icon-48px.png?resize=48%2C48&ssl=1)

![Linux at Home](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/linux-at-home-icon-48px.png?resize=48%2C48&ssl=1)

[looks at a range of home activities where Linux can play its part, making the most of our time at home, keeping active and engaged.](/linux-home-cooking-linux/)**Linux at Home**![Linux Candy](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/linux-candy-icon-48px.png?resize=48%2C48&ssl=1)

![Linux Candy](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/linux-candy-icon-48px.png?resize=48%2C48&ssl=1)

[reveals the lighter side of Linux. Have some fun and escape from the daily drudgery.](/linux-candy-free-and-open-source-software-fun/)**Linux Candy**![Docker](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2021/11/Docker-icon-48.png?resize=48%2C48&ssl=1)

![Docker](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2021/11/Docker-icon-48.png?resize=48%2C48&ssl=1)

[helps you master Docker, a set of platform as a service products that delivers software in packages called containers.](/getting-started-docker-install-docker-engine/)**Getting Started with Docker**![Android Apps](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/android-apps-icon-48px.png?resize=48%2C48&ssl=1)

![Android Apps](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/android-apps-icon-48px.png?resize=48%2C48&ssl=1)

[. We showcase free Android apps that are definitely worth downloading. There's a strict eligibility criteria for inclusion in this series.](/best-free-android-apps/)**Best Free Android Apps**![Programming Books](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/programming-books-icon-48px.png?resize=48%2C48&ssl=1)

![Programming Books](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/programming-books-icon-48px.png?resize=48%2C48&ssl=1)

[accelerate your learning of every programming language. Learn a new language today!](/excellent-free-programming-books/)**best free books**![Programming Tutorials](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/programming-tutorials-icon-48px.png?resize=48%2C48&ssl=1)

![Programming Tutorials](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/programming-tutorials-icon-48px.png?resize=48%2C48&ssl=1)

[offer the perfect tonic to our free programming books series.](/category/tutorials/)**free tutorials**![Linux Around The World](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/07/linux-around-world-icon-48px.png?resize=48%2C48&ssl=1)

![Linux Around The World](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/07/linux-around-world-icon-48px.png?resize=48%2C48&ssl=1)

[showcases usergroups that are relevant to Linux enthusiasts. Great ways to meet up with fellow enthusiasts.](/linux-world/)**Linux Around The World**![Stars and Stripes](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/stars-stripes-icon-48px.png?resize=48%2C48&ssl=1)

![Stars and Stripes](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2022/05/stars-stripes-icon-48px.png?resize=48%2C48&ssl=1)

[is an occasional series looking at the impact of Linux in the USA.](/stars-stripes-nasa-linux/)**Stars and Stripes**
How do I install this on Debian or CentOS?

# apt-get install football-cli

Reading package lists… Done

Building dependency tree

Reading state information… Done

E: Unable to locate package football-cli

# yum install football-cli

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirror.rackspace.com

* epel: fedora-epel.mirror.lstn.net

* extras: mirrordenver.fdcservers.net

* updates: mirrors.tummy.com

No package football-cli available.

Error: Nothing to do

Assuming you don’t already have the JavaScript package manager installed, type:

sudo apt install npm

then type:

sudo npm install -g footballcli