refactor utils.go, error handling

This commit is contained in:
2022-02-16 08:11:34 +01:00
parent 99a2519ecb
commit 47f0fb6c66
6 changed files with 731 additions and 615 deletions

22
pkgbuild.go Normal file
View File

@@ -0,0 +1,22 @@
package main
import (
"path/filepath"
"strings"
)
type PKGBUILD string
func (p PKGBUILD) FullRepo() string {
sPkgbuild := strings.Split(string(p), string(filepath.Separator))
return sPkgbuild[len(sPkgbuild)-2]
}
func (p PKGBUILD) Repo() string {
return strings.Split(p.FullRepo(), "-")[0]
}
func (p PKGBUILD) PkgBase() string {
sPkgbuild := strings.Split(string(p), string(filepath.Separator))
return sPkgbuild[len(sPkgbuild)-4]
}