From 1a3999baf4c30211a608ec6ad48ee3a29f07d3c2 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 31 Dec 2017 12:14:17 +0900 Subject: [PATCH] describe xz support in doc --- README.md | 6 +++--- selfupdate/doc.go | 2 +- selfupdate/uncompress.go | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c92bce0..6044c70 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ If newer version than itself is detected, it downloads released binary from GitH - Retrieve the proper binary for the OS and arch where the binary is running - Update the binary with rollback support on failure - Tested on Linux, macOS and Windows (using Travis CI and AppVeyor) -- Many archive and compression formats are supported (zip, gzip, tar) +- Many archive and compression formats are supported (zip, tar, gzip, xzip) And small wrapper CLIs are provided: @@ -169,7 +169,7 @@ You need to put the binaries with the following format. `{cmd}` is a name of command. `{goos}` and `{goarch}` are the platform and the arch type of the binary. -`{.ext}` is a file extension. go-github-selfupdate supports `.zip`, `.gzip` and `.tar.gz`. +`{.ext}` is a file extension. go-github-selfupdate supports `.zip`, `.gzip`, `.tar.gz` and `.tar.xz`. You can also use blank and it means binary is not compressed. If you compress binary, uncompressed directory or file must contain the executable named `{cmd}`. @@ -182,7 +182,7 @@ page on GitHub as binary for platform `linux` and arch `amd64`. - `foo-bar_linux_amd64` (executable) - `foo-bar_linux_amd64.zip` (zip file containing `foo-bar`) - `foo-bar_linux_amd64.tar.gz` (tar file containing `foo-bar`) -- `foo-bar_linux_amd64.gzip` (gzip file of the executable `foo-bar`) +- `foo-bar_linux_amd64.xz` (xzip file of the executable `foo-bar`) - `foo-bar-linux-amd64.tar.gz` (`-` is also ok for separator) To archive the executable directly on Windows, `.exe` can be added before file extension like diff --git a/selfupdate/doc.go b/selfupdate/doc.go index 522ba63..38fc167 100644 --- a/selfupdate/doc.go +++ b/selfupdate/doc.go @@ -18,7 +18,7 @@ If newer version than itself is detected, it downloads released binary from GitH - Retrieve the proper binary for the OS and arch where the binary is running - Update the binary with rollback support on failure - Tested on Linux, macOS and Windows -- Many archive and compression formats are supported (zip, gzip, tar) +- Many archive and compression formats are supported (zip, gzip, xzip, tar) There are some naming rules. Please read following links. diff --git a/selfupdate/uncompress.go b/selfupdate/uncompress.go index c5e7248..cbbefeb 100644 --- a/selfupdate/uncompress.go +++ b/selfupdate/uncompress.go @@ -32,7 +32,10 @@ func unarchiveTar(src io.Reader, url, cmd string) (io.Reader, error) { return nil, fmt.Errorf("File '%s' for the command is not found in %s", cmd, url) } -// UncompressCommand uncompresses the given source. Archive and compression format is automatically detected from 'url' parameter, which represents the URL of asset. This returns a reader for the uncompressed command given by 'cmd'. +// UncompressCommand uncompresses the given source. Archive and compression format is +// automatically detected from 'url' parameter, which represents the URL of asset. +// This returns a reader for the uncompressed command given by 'cmd'. '.zip', +// '.tar.gz', '.tar.xz', '.gz' and '.xz' are supported. func UncompressCommand(src io.Reader, url, cmd string) (io.Reader, error) { if strings.HasSuffix(url, ".zip") { log.Println("Uncompressing zip file", url)