Skip to content

Commit 5b0af36

Browse files
committed
add option for folder wrapping
1 parent 5277f98 commit 5b0af36

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

build.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Configuration struct {
2323
Amd64Substring string
2424
Arm64Substring string
2525
Compressed bool
26+
FolderWrapped bool
2627
BinaryPath string
2728
GithubToken string
2829
Overwrite bool
@@ -173,7 +174,14 @@ func (cfg *Configuration) DownloadAndGetPath(asset *github.ReleaseAsset) (string
173174
if err != nil {
174175
return "", err
175176
}
176-
binary = filepath.Join(extractDir, cfg.BinaryPath)
177+
178+
if cfg.FolderWrapped {
179+
folderName := strings.ReplaceAll(name, ".tar.gz", "")
180+
binary = filepath.Join(extractDir, folderName, cfg.BinaryPath)
181+
} else {
182+
binary = filepath.Join(extractDir, cfg.BinaryPath)
183+
}
184+
177185
} else {
178186
binary = downloadLocation
179187
}

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ func main() {
5454
Usage: "Do the releases use compressed archives",
5555
Destination: &cfg.Compressed,
5656
},
57+
&cli.BoolFlag{
58+
Name: "folder-wrapped",
59+
Required: false,
60+
Usage: "Are the files wrapped inside a folder with name of the archive",
61+
Destination: &cfg.FolderWrapped,
62+
},
5763
&cli.StringFlag{
5864
Name: "binary-path",
5965
Required: false,

0 commit comments

Comments
 (0)