Make linux labeling more precise for AI completions

This commit is contained in:
David Dworken 2023-12-19 20:54:56 -08:00
parent 9b5a09f85e
commit f4ee4e7175
No known key found for this signature in database

View File

@ -5,6 +5,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os" "os"
"os/exec"
"runtime" "runtime"
"time" "time"
@ -37,6 +38,15 @@ func GetAiSuggestions(ctx context.Context, query string, numberCompletions int)
func getOsName() string { func getOsName() string {
switch runtime.GOOS { switch runtime.GOOS {
case "linux": case "linux":
if _, err := exec.LookPath("apt-get"); err == nil {
return "Ubuntu Linux"
}
if _, err := exec.LookPath("dnf"); err == nil {
return "Fedora Linux"
}
if _, err := exec.LookPath("pacman"); err == nil {
return "Arch Linux"
}
return "Linux" return "Linux"
case "darwin": case "darwin":
return "MacOS" return "MacOS"