-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
al1-ce
committed
Nov 24, 2022
1 parent
18bc5e2
commit e04038d
Showing
11 changed files
with
647 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ docs/ | |
|
||
# Code coverage | ||
*.lst | ||
|
||
bin/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "dub", | ||
"run": false, | ||
"cwd": "${workspaceFolder}", | ||
"compiler": "$current", | ||
"archType": "$current", | ||
"buildType": "$current", | ||
"configuration": "$current", | ||
"problemMatcher": [ | ||
"$dmd" | ||
], | ||
"group": "build", | ||
"label": "dub: Build pkm", | ||
"detail": "dub build --compiler=dmd -a=x86_64 -b=debug -c=application" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,24 @@ | ||
# pkm | ||
Simple Yay wrapper | ||
**P**ac**K**age**M**anager - Simple apt-style [Yay](https://github.com/Jguer/yay) wrapper | ||
|
||
## Description | ||
|
||
### Why? | ||
|
||
## Installation | ||
|
||
### Source | ||
|
||
### Binary | ||
|
||
### AUR | ||
|
||
## First Use | ||
|
||
## Commands | ||
|
||
## Config | ||
|
||
## FAQ | ||
|
||
## Images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"authors": [ | ||
"Alisa Lain" | ||
], | ||
"copyright": "Copyright © 2022, Alisa Lain", | ||
"dependencies": { | ||
"dyaml": "~>0.9.2" | ||
}, | ||
"description": "Simple Yay wrapper", | ||
"license": "MIT License", | ||
"name": "pkm", | ||
"targetName": "pkm", | ||
"targetPath": "bin" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"fileVersion": 1, | ||
"versions": { | ||
"dyaml": "0.9.2", | ||
"tinyendian": "0.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import std.stdio; | ||
import std.getopt; | ||
import std.array: popFront, join; | ||
import std.process: execute, environment, executeShell, Config, spawnProcess, wait; | ||
|
||
import pkm.search; | ||
|
||
import sily.getopt; | ||
|
||
// --aur -a | ||
// --no-aur | ||
// --version -v | ||
// --help -h | ||
// search | yay -Ss term | ||
// list | yay -Q | ||
// info | yay -Qi | ||
// install | yay -S term | ||
// reinstall | yay -R & yay -S | ||
// remove | yay -R term | ||
// checkupdates | yay -Qu | ||
// update | yay -Sy | ||
// upgrade | yay -Su | ||
// clone | ||
// build | ||
// clean | yay -Yc | ||
// -- custom -- | ||
// stats | yay -Ps | ||
// pkgbuild | yay -G term | yay -Gp term | ||
|
||
private const string _version = "pkm v1.0.0"; | ||
|
||
int main(string[] args) { | ||
version(Windows) { | ||
writefln("Unable to run on windows."); | ||
return 1; | ||
} | ||
|
||
bool optVersion = false; | ||
bool optAur = false; | ||
|
||
auto help = getopt( | ||
args, | ||
config.bundling, config.passThrough, | ||
"version", "print version", &optVersion, | ||
"aur|a", "search only aur", &optAur | ||
); | ||
|
||
Commands[] coms = [ | ||
Commands("search", "[option] <package(s)>"), | ||
Commands("list", "[option]"), | ||
Commands("info", "[option] <package(s)>"), | ||
Commands("install", "[option] <package(s)>"), | ||
// Commands("reinstall", "[option] <package(s)>"), | ||
Commands("remove", "[option] <package(s)>"), | ||
Commands("checkupdates", "[option]"), | ||
Commands("update", "[option] <package(s)>"), | ||
Commands("upgrade", "[option] <package(s)>"), | ||
Commands("clean", "[option]"), | ||
Commands("stats", "[option]"), | ||
Commands("pkgbuild", "[option] <package(s)>"), | ||
]; | ||
|
||
if (optVersion) { | ||
writeln(_version); | ||
return 0; | ||
} | ||
|
||
if (help.helpWanted || args.length == 1) { | ||
printGetopt("", "pkm <operation> [...]", coms, help.options); | ||
return 0; | ||
} | ||
|
||
string yay = "/usr/bin/yay"; | ||
|
||
string[] ops = args.dup; | ||
ops.popFront(); // removes [0] command | ||
ops.popFront(); // removes 'command' | ||
|
||
if (optAur) { | ||
ops ~= ["--aur"]; | ||
} | ||
|
||
switch (args[1]) { | ||
case "search": | ||
return search(ops); | ||
case "list": | ||
return wait(spawnProcess([yay, "-Q"])); | ||
case "info": | ||
return wait(spawnProcess([yay, "-Qi"] ~ ops)); | ||
case "install": | ||
return wait(spawnProcess([yay, "-S"] ~ ops)); | ||
// case "reinstall": | ||
// return wait(spawnProcess([yay, "-R"] ~ ops)); | ||
// return wait(spawnProcess([yay, "-S"] ~ ops)); | ||
case "remove": | ||
return wait(spawnProcess([yay, "-R"] ~ ops)); | ||
case "checkupdates": | ||
return wait(spawnProcess([yay, "-Qu"] ~ ops)); | ||
case "update": | ||
return wait(spawnProcess([yay, "-Sy"] ~ ops)); | ||
case "upgrade": | ||
return wait(spawnProcess([yay, "-Su"] ~ ops)); | ||
case "clean": | ||
return wait(spawnProcess([yay, "-Yc"])); | ||
case "stats": | ||
return wait(spawnProcess([yay, "-Ps"])); | ||
case "pkgbuild": | ||
return wait(spawnProcess([yay, "-Gp"] ~ ops)); | ||
default: | ||
writefln("Unknown command \"%s\".", args[1]); | ||
return 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module pkm.pkg; | ||
|
||
// repo | ||
// name | ||
// version | ||
// (size (package size, installed size) | aur-votes (votes, popularity)) | ||
// [group]? | ||
// (orphaned) | ||
// (outofdate) | ||
// (installed: (version)) \n | ||
// (description) | ||
|
||
struct Pkg { | ||
string repo = "aur"; | ||
string name = "Package"; | ||
string ver = "v0.0.0"; | ||
string pkgsize = "0 KB"; // not aur | ||
string inssize = "0 KB"; | ||
string group = ""; // community only | ||
bool isOrphaned = false; | ||
bool isOutdated = false; | ||
string outdatedDate = ""; | ||
bool isInstalled = false; | ||
string installedVersion = ""; | ||
string description = ""; | ||
|
||
alias aurvotes = pkgsize; // aur | ||
alias aurpopul = inssize; | ||
} |
Oops, something went wrong.