Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support short file extensions as format #1876

Closed
suzuki-shunsuke opened this issue Apr 12, 2023 · 0 comments · Fixed by #2313
Closed

Support short file extensions as format #1876

suzuki-shunsuke opened this issue Apr 12, 2023 · 0 comments · Fixed by #2313
Labels
enhancement New feature or request
Milestone

Comments

@suzuki-shunsuke
Copy link
Member

suzuki-shunsuke commented Apr 12, 2023

Feature Overview

Support short file extensions as format.

func getFormatAliases() map[string]string {
return map[string]string{
"tbr": "tar.br",
"tbz": "tar.bz2",
"tgz": "tar.gz",
"tlz4": "tar.lz4",
"tsz": "tar.sz",
"txz": "tar.xz",
}
}
func (unarchiver *UnarchiverImpl) getUnarchiver(src *File, dest string) (coreUnarchiver, error) {
filename := filepath.Base(src.Filename)
if IsUnarchived(src.Type, filename) {
return &rawUnarchiver{
dest: filepath.Join(dest, filename),
}, nil
}
if src.Type == "dmg" {
return &dmgUnarchiver{
dest: dest,
executor: unarchiver.executor,
}, nil
}
f := filename
if src.Type != "" {
if a, ok := getFormatAliases()[src.Type]; ok {
f = "." + a
} else {
f = "." + src.Type
}
}

https://github.com/aquaproj/aqua-registry/blob/ac164cfd68015be9ea44deb5215f9260fe9ccbcf/pkgs/aristocratos/btop/registry.yaml

AS IS

    asset: btop-{{.Arch}}-{{.OS}}.tbz
    format: tar.bz2

TO BE

    asset: btop-{{.Arch}}-{{.OS}}.{{.Format}}
    format: tbz

Why is the feature needed?

Please explain the problem you want to solve.

Does the feature include Breaking Changes?

Example Code

command and configuration

$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
1 participant