mirror of
https://github.com/MedzikUser/go-github-selfupdate.git
synced 2024-08-15 03:25:29 +00:00
describe xz support in doc
This commit is contained in:
parent
f8d9336cde
commit
1a3999baf4
3 changed files with 8 additions and 5 deletions
|
@ -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
|
- Retrieve the proper binary for the OS and arch where the binary is running
|
||||||
- Update the binary with rollback support on failure
|
- Update the binary with rollback support on failure
|
||||||
- Tested on Linux, macOS and Windows (using Travis CI and AppVeyor)
|
- 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:
|
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.
|
`{cmd}` is a name of command.
|
||||||
`{goos}` and `{goarch}` are the platform and the arch type of the binary.
|
`{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.
|
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}`.
|
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` (executable)
|
||||||
- `foo-bar_linux_amd64.zip` (zip file containing `foo-bar`)
|
- `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.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)
|
- `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
|
To archive the executable directly on Windows, `.exe` can be added before file extension like
|
||||||
|
|
|
@ -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
|
- Retrieve the proper binary for the OS and arch where the binary is running
|
||||||
- Update the binary with rollback support on failure
|
- Update the binary with rollback support on failure
|
||||||
- Tested on Linux, macOS and Windows
|
- 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.
|
There are some naming rules. Please read following links.
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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) {
|
func UncompressCommand(src io.Reader, url, cmd string) (io.Reader, error) {
|
||||||
if strings.HasSuffix(url, ".zip") {
|
if strings.HasSuffix(url, ".zip") {
|
||||||
log.Println("Uncompressing zip file", url)
|
log.Println("Uncompressing zip file", url)
|
||||||
|
|
Loading…
Reference in a new issue