summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorhuker667 <huker@tuta.io>2026-08-11 18:58:45 +0300
committerhuker667 <huker@tuta.io>2026-08-11 18:58:45 +0300
commitd6ebd95cbdbd98b959e52122f2924621b510d291 (patch)
treea8a176a2c7186d2a99b2c214a2f6a4aa9af95c0c /main.go
parent22359129afeef78e0fcd56e62586819c06950846 (diff)
downloadqulay-main.tar.gz
qulay-main.tar.bz2
qulay-main.zip
ебать крупнейшее обновление 1.0HEADmain
Diffstat (limited to 'main.go')
-rw-r--r--main.go93
1 files changed, 75 insertions, 18 deletions
diff --git a/main.go b/main.go
index 74aabb4..6433ba3 100644
--- a/main.go
+++ b/main.go
@@ -13,29 +13,41 @@ import (
)
var _name string = filepath.Base(os.Args[0])
-var _cmds = []string{"h", "+", "-", "g", "s", "p", "u", "r", "q", "f", "v"}
-var _root_cmds = []string{"+", "-", "u", "i"}
+var _cmds = []string{"h", "+", "-", "g", "s", "p", "u", "r", "q", "f", "v", "b", "o"}
-const _version string = "0.7"
-const _help string = `{_name}: command-line interface to the Qulay Package Manager
+const _version string = "1.0"
+const _help string = `{_name}: Qulay Package Manager
Usage:
{_name} h -> help menu
- {_name} + pkg -> download and install package
+ {_name} + pkg -> download and install package (or .qpmp file path)
{_name} - pkg -> remove package
+ {_name} b pkg -> build package into .tar.zst (or .qpmp on :qpmp)
{_name} g pkg -> get package version
{_name} s pkg -> search packages by name
{_name} p repo -> purge local repo directory
{_name} u -> update all repositories
- {_name} r -> get all repositories URLs
+ {_name} r -> get all repositories configs
+ {_name} o -> upgrade all installed packages
{_name} q -> get all installed packages
{_name} f -> get files path for destDir
{_name} v -> get {_name} version
Options:
- :v -> verbose output
:a -> ask before doing
:nl -> disable recording in databases and logs
:nd -> do not download deps
:r -> reinstall already installed deps
+ :f -> force install (ignore conflicts)
+ :qpmp -> build a .qpmp archive instead of .tar.zst
+Tags (for +, - , b and o):
+ @all -> apply to all packages
+ repo/@all -> apply to all packages in repo
+ @inst -> apply to installed (for b: built) packages
+ repo/@inst -> apply to installed (for b: built) packages in repo
+ @notinst -> apply to not installed (for b: not built) packages
+ repo/@notinst-> apply to not installed (for b: not built) packages in repo
+ @old -> apply to installed/built packages outdated by version
+ repo/@old -> apply to outdated packages in repo
+ o without tags applies @old automatically
Vars:
DESTDIR -> path where the package will be installed/removed`
@@ -86,7 +98,12 @@ func main() {
fmt.Println("!! no package(s) received")
os.Exit(1)
}
- for _, n := range oths {
+ names, err := pkg.Expand("+", oths, absDestDir)
+ if err != nil {
+ fmt.Println("!!", err)
+ os.Exit(1)
+ }
+ for _, n := range names {
err := pkg.Install(n, opts, absDestDir)
if err != nil {
fmt.Println("!!", err)
@@ -98,7 +115,12 @@ func main() {
fmt.Println("!! no package(s) received")
os.Exit(1)
}
- for _, n := range oths {
+ names, err := pkg.Expand("-", oths, absDestDir)
+ if err != nil {
+ fmt.Println("!!", err)
+ os.Exit(1)
+ }
+ for _, n := range names {
err := pkg.Remove(n, opts, absDestDir)
if err != nil {
fmt.Println("!!", err)
@@ -106,7 +128,24 @@ func main() {
}
}
} else if cmds[0] == "u" {
- database.DownloadRepos(database.GetReposUrls(absDestDir), absDestDir)
+ database.DownloadRepos(absDestDir)
+ } else if cmds[0] == "b" {
+ if len(oths) < 1 {
+ fmt.Println("!! no package(s) received")
+ os.Exit(1)
+ }
+ names, err := pkg.Expand("b", oths, absDestDir)
+ if err != nil {
+ fmt.Println("!!", err)
+ os.Exit(1)
+ }
+ for _, n := range names {
+ err := pkg.Build(n, opts, absDestDir)
+ if err != nil {
+ fmt.Println("!!", err)
+ os.Exit(1)
+ }
+ }
} else if cmds[0] == "g" {
if len(oths) < 1 {
fmt.Println("!! no package(s) received")
@@ -116,21 +155,37 @@ func main() {
fmt.Println(database.GetPackageVersion(name, absDestDir))
}
} else if cmds[0] == "r" {
- for _, url := range database.GetReposUrls(absDestDir) {
- fmt.Println(url)
+ for _, repo := range database.GetRepos(absDestDir) {
+ fmt.Println(repo.Name, "url:", repo.URL)
+ }
+ } else if cmds[0] == "o" {
+ if len(oths) < 1 {
+ oths = []string{"@old"}
+ }
+ names, err := pkg.Expand("o", oths, absDestDir)
+ if err != nil {
+ fmt.Println("!!", err)
+ os.Exit(1)
+ }
+ err = pkg.Upgrade(names, opts, absDestDir)
+ if err != nil {
+ fmt.Println("!!", err)
+ os.Exit(1)
}
} else if cmds[0] == "q" {
for name, version := range database.ReadInstalled(absDestDir) {
- fmt.Println(name, "-", version[0])
+ if len(version) > 0 {
+ fmt.Println(name, "-", version[0])
+ }
}
} else if cmds[0] == "s" {
if len(oths) < 1 {
pkgs := pkg.GetPackages(absDestDir)
for _, p := range pkgs {
if database.IsInstalled(p.Repo+"/"+p.Name, absDestDir) {
- fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
+ fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
} else {
- fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
+ fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
}
}
} else {
@@ -138,9 +193,9 @@ func main() {
pkgs := pkg.FindPackages(n, absDestDir)
for _, p := range pkgs {
if database.IsInstalled(p.Repo+"/"+p.Name, absDestDir) {
- fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
+ fmt.Printf("[+] %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
} else {
- fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Data[0], p.Data[1])
+ fmt.Printf(" %s/%s - %v - %v\n", p.Repo, p.Name, p.Version, p.Desc)
}
}
}
@@ -166,9 +221,11 @@ func main() {
fmt.Printf("dest dir: %v\n", destDir)
fmt.Printf("abs dest dir: %v\n", absDestDir)
fmt.Printf("is abs: %v\n", filepath.IsAbs(destDir))
- fmt.Printf("repos urls file: %v\n", filepath.Join(absDestDir, paths.ReposUrlsFile))
+ fmt.Printf("repos config dir: %v\n", filepath.Join(absDestDir, paths.ReposConfigDir))
fmt.Printf("repos dir: %v\n", filepath.Join(absDestDir, paths.ReposDir))
fmt.Printf("installed pkgs database: %v\n", filepath.Join(absDestDir, paths.InstalledFile))
+ fmt.Printf("built pkgs dir: %v\n", filepath.Join(absDestDir, paths.BuiltDir))
+ fmt.Printf("build config file: %v\n", filepath.Join(absDestDir, paths.BuildConfigFile))
} else if cmds[0] == "v" {
fmt.Println(_version)
} else {