feat: rorkos support
This commit is contained in:
parent
d9c3b47dc9
commit
fa5f941418
@ -15,7 +15,7 @@ import (
|
|||||||
var ansiEscapeRe = regexp.MustCompile(`\x1b\[[0-9;?]*[ -/]*[@-~]`)
|
var ansiEscapeRe = regexp.MustCompile(`\x1b\[[0-9;?]*[ -/]*[@-~]`)
|
||||||
|
|
||||||
func GetLogo(id string, conf Config, ascii *bool) string {
|
func GetLogo(id string, conf Config, ascii *bool) string {
|
||||||
knownIDs := []string{"arch", "nixos", "debian", "alpine", "gentoo", "void", "chimera", "cachyos", "artix", "endeavouros", "fedora", "kali", "linuxmint", "manjaro", "ubuntu", "opensuse"}
|
knownIDs := []string{"arch", "nixos", "debian", "alpine", "gentoo", "void", "chimera", "cachyos", "artix", "endeavouros", "fedora", "kali", "linuxmint", "manjaro", "ubuntu", "opensuse", "rorkos"}
|
||||||
if slices.Contains(knownIDs, id) {
|
if slices.Contains(knownIDs, id) {
|
||||||
if conf.Ascii || (ascii != nil && *ascii) == true {
|
if conf.Ascii || (ascii != nil && *ascii) == true {
|
||||||
return path.Join("logos", id+".txt")
|
return path.Join("logos", id+".txt")
|
||||||
|
|||||||
@ -16,12 +16,13 @@ func pathExists(path string) bool {
|
|||||||
|
|
||||||
func getPmPackages(packagerName string, packagerPath string) string {
|
func getPmPackages(packagerName string, packagerPath string) string {
|
||||||
if pathExists(packagerPath) {
|
if pathExists(packagerPath) {
|
||||||
pkgs, err := os.ReadDir(packagerPath)
|
if packagerName == "ror" {
|
||||||
|
file, err := os.ReadFile(packagerPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "error reading " + packagerPath
|
return "error reading ror file"
|
||||||
}
|
}
|
||||||
if packagerName == "pacman" {
|
count := strings.Count(string(file), "\"") / 2
|
||||||
return strconv.Itoa(len(pkgs)-1) + " (pacman)"
|
return strconv.Itoa(count) + " (ror)"
|
||||||
}
|
}
|
||||||
if packagerName == "apk" {
|
if packagerName == "apk" {
|
||||||
out, err := exec.Command("apk", "info").Output()
|
out, err := exec.Command("apk", "info").Output()
|
||||||
@ -39,6 +40,14 @@ func getPmPackages(packagerName string, packagerPath string) string {
|
|||||||
|
|
||||||
return fmt.Sprintf("%d (apk)", pkgCount)
|
return fmt.Sprintf("%d (apk)", pkgCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkgs, err := os.ReadDir(packagerPath)
|
||||||
|
if err != nil {
|
||||||
|
return "error reading " + packagerPath
|
||||||
|
}
|
||||||
|
if packagerName == "pacman" {
|
||||||
|
return strconv.Itoa(len(pkgs)-1) + " (pacman)"
|
||||||
|
}
|
||||||
if packagerName == "emerge" {
|
if packagerName == "emerge" {
|
||||||
count := 0
|
count := 0
|
||||||
for _, cat := range pkgs {
|
for _, cat := range pkgs {
|
||||||
@ -70,6 +79,7 @@ func GetPkgs() string {
|
|||||||
{"pacman", "/var/lib/pacman/local"},
|
{"pacman", "/var/lib/pacman/local"},
|
||||||
{"nix-user", os.Getenv("HOME") + "/.local/state/nix/profiles/profile/bin"},
|
{"nix-user", os.Getenv("HOME") + "/.local/state/nix/profiles/profile/bin"},
|
||||||
{"nix", "/run/current-system/sw/bin"},
|
{"nix", "/run/current-system/sw/bin"},
|
||||||
|
{"ror", "/etc/ror/installed.json"},
|
||||||
{"apt", "/var/lib/apt"},
|
{"apt", "/var/lib/apt"},
|
||||||
{"dnf", "/var/lib/dnf"},
|
{"dnf", "/var/lib/dnf"},
|
||||||
{"zypper", "/var/lib/zypp"},
|
{"zypper", "/var/lib/zypp"},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user