Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ var LoadingSpinner = spinner.New(spinner.CharSets[9], 100*time.Millisecond, spin
// RegexDarwin is a regular express for darwin systems
var RegexDarwin = `(?i)(darwin|mac(os)?|apple|osx)`

// RegexLinux is a regular express for linux systems
var RegexLinux = `(?i)(linux|.deb)`

// RegexWindows is a regular express for windows systems
var RegexWindows = `(?i)(windows|win|.msi|.exe)`

Expand Down
12 changes: 11 additions & 1 deletion lib/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ func DetectAsset(userOS string, userArch string, releaseAssets []string) (string
reOS, err = regexp.Compile(constants.RegexDarwin)
case "windows":
reOS, err = regexp.Compile(constants.RegexWindows)
case "linux":
reOS, err = regexp.Compile(constants.RegexLinux)
default:
reOS, err = regexp.Compile(`(?i)` + userOS)
}
Expand Down Expand Up @@ -187,7 +189,8 @@ func DetectAsset(userOS string, userArch string, releaseAssets []string) (string
}

var finalAsset string
if len(detectedFinalAssets) != 1 {
if len(detectedFinalAssets) <= 1 {
fmt.Printf("detectedFinalAssets: %v\n", detectedFinalAssets)
if userOS == "darwin" && userArch == "arm64" {
finalAsset, err = darwinARMFallback(detectedOSAssets)
if err != nil {
Expand All @@ -200,6 +203,13 @@ func DetectAsset(userOS string, userArch string, releaseAssets []string) (string
return "", err
}
}
} else if len(detectedFinalAssets) >= 1 {
if finalAsset == "" {
finalAsset, err = WarningPromptSelect("Found several assets. Please select it manually:", detectedFinalAssets)
if err != nil {
return "", err
}
}
} else {
finalAsset = detectedFinalAssets[0]
}
Expand Down