简体   繁体   English

如何通过命令行从最新版本下载 GitHub 资产?

[英]How to download GitHub assets from the latest release via command line?

https://github.com/irssi/irssi/releases/latest https://github.com/irssi/irssi/releases/latest

I would like to have a set of command line commands to download the latest version of the two files (*.tar.gz and *.patch).我想要一组命令行命令来下载这两个文件(*.tar.gz 和*.patch)的最新版本。 The filename of the.tar.gz archive changes with the releases version so I can't get a static path for the filename. .tar.gz 存档文件的文件名随发布版本而变化,因此我无法获得文件名的 static 路径。

Powershell commands preferred.首选 Powershell 命令。

I would use GNU Wget following way:我会按照以下方式使用 GNU Wget:

wget --recursive --level=1 --no-directories --accept-regex '(tar.gz|patch)$' https://github.com/irssi/irssi/releases/latest

which you should run in empty directory.你应该在空目录中运行。 Explanation: use recursive download option of wget with depth 1 (ie consider only links in page), do not create hierarchy mirroring that of site (ie put all in current working directory), look for links which do contain regular expression.说明:使用深度为 1 的 wget 递归下载选项(即仅考虑页面中的链接),不创建站点镜像的层次结构(即全部放在当前工作目录中),寻找包含正则表达式的链接。 Here $ denotes end of string and |这里$表示字符串的结尾和| denotes or , so its meaning is: links ending with tar.gz or patch表示or ,所以它的意思是:以tar.gzpatch结尾的链接

(tested in GNU Wget 1.20.3) (在 GNU Wget 1.20.3 中测试)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM