From e06db3840ca77bcb5ffa3f7bf2502918890c9364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 22 Jan 2019 00:00:00 +0000 Subject: [PATCH] release-download-latest: bring back to life --- release-download-latest | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/release-download-latest b/release-download-latest index ee23a11..20def80 100755 --- a/release-download-latest +++ b/release-download-latest @@ -1,17 +1,26 @@ #!/usr/bin/env python3 -''' -Usage: https://github.com/cirosantilli/linux-kernel-module-cheat#prebuilt - -Implementation: -https://stackoverflow.com/questions/24987542/is-there-a-link-to-github-for-downloading-a-file-in-the-latest-release-of-a-repo/50540591#50540591 -''' - import urllib.request import common from shell_helpers import LF -_json = self.github_make_request(path='/releases') -asset = _json[0]['assets'][0] -urllib.request.urlretrieve(asset['browser_download_url'], asset['name']) +class Main(common.LkmcCliFunction): + def __init__(self): + super().__init__( + description='''\ +Usage: https://github.com/cirosantilli/linux-kernel-module-cheat#prebuilt + +Implementation: +https://stackoverflow.com/questions/24987542/is-there-a-link-to-github-for-downloading-a-file-in-the-latest-release-of-a-repo/50540591#50540591 +''', + ) + + def timed_main(self): + self.log_info('Downloading the release, this may take several seconds / a few minutes.') + _json = self.github_make_request(path='/releases') + asset = _json[0]['assets'][0] + urllib.request.urlretrieve(asset['browser_download_url'], asset['name']) + +if __name__ == '__main__': + Main().cli()