async function _pkg93execdonotcallplsusetheapi(cli) {
pkg93.version = "v2.0.0beta2";
var protect = ["3d", "acid", "acidbox", "ansi", "anthology", "arena93", "bananamp", "base64", "bytebeat", "calc", "castlegafa", "catex", "cd", "clear", "clearhist", "clippy", "code", "contact", "crazy", "defrag", "dmg", "do a barrel roll", "doctor", "download", "find", "font", "format", "fullscreen", "fx", "gameoflife", "glitch", "global thermonuclear war", "gravity", "hampster", "hello", "help", "hexed", "history", "hl3", "hydra", "ie6", "iframe", "img", "info", "js", "key", "killall", "layer", "lenna", "lisa", "ls", "manifesto", "marburg", "messenger", "mines", "necronomicoin", "pd", "piskel", "pkg93", "pony", "potato", "progressquest", "pwd", "reboot", "robby", "rotate", "shutdown", "skifree", "solitude", "speech", "starwars", "superplayer", "takethis", "terminal", "textarea", "tree", "trollbox", "vega", "virtualpc", "vm", "wat", "whatif", "whois", "win", "zkype", "peng"];
var args = cli.arg.arguments;
var help = `pkg93 ${pkg93.version}
Usage: pkg93 [command]
List of Commands
pull Updates package listing
get [package] Installs a package
rm [package] Uninstalls a package
add-repo [url] Adds a repository
rm-repo [id] Removes a repository
info [pkg] Gets information on a package
ls [pkgs|installed|repos] Lists packages, installed
packages or repositories.
Color meanings
Executing OK Error Warning Info
If you find my software useful, consider donating here.
`;
if (localStorage[".pkg93/config.json"] === undefined) {
localStorage[".pkg93/config.json"] = "{\"repos\": [\"https://1024x2.xyz/main-repo\"], \"installed\": [], \"pkglist\": []}";
}
if (localStorage[".pkg93/packages/"] === undefined) {
localStorage[".pkg93/packages/"] = "";
}
localStorage[".pkg93/README.txt"] = "WARNING!\nThis folder contains important data about pkg93. Do not edit anything in here unless you want pkg93 to not work!\n\n~1024x2";
var config = pkg93.getConfig();
if (args.length === 0) {
cli.log(help);
} else if (args[0] == "pull") {
await pkg93.pull(cli);
} else if (args[0] == "get") {
if (args.length < 2) {
cli.log("ERR No package specified.");
} else if (protect.includes(args[1])) {
cli.log("ERR You're trying to modify a pre-installed Windows93 app.\n Don't do that!");
} else {
var name = args[1].split("@")[0];
var version = args[1].split("@")[1];
await pkg93.get(name, version, cli);
}
} else if (args[0] == "rm") {
if (args.length < 2) {
cli.log("ERR No package specified.");
} else if (protect.includes(args[1])) {
cli.log("ERR You're trying to modify a pre-installed Windows93 app.\n Don't do that!");
} else {
pkg93.rm(args[1], cli);
}
} else if (args[0] == "add-repo") {
if (args.length < 2) {
cli.log("ERR No repository specified.");
} else {
try {
config.repos.push(args[1]); // well, that was easy
localStorage[".pkg93/config.json"] = JSON.stringify(config);
cli.log("OK Done!\n Run \"pkg93 pull\" to update the package listing.");
} catch (err) {
cli.log("ERR " + err.message);
}
}
} else if (args[0] == "rm-repo") {
if (args.length < 2) {
cli.log("ERR No repository specified.");
} else {
try {
config.repos.splice(parseInt(args[1]), 1);
localStorage[".pkg93/config.json"] = JSON.stringify(config);
cli.log("OK Done!\n Run \"pkg93 pull\" to update the package listing.");
} catch (err) {
cli.log("ERR " + err.message);
}
}
} else if (args[0] == "ls") {
if (args[1] == "pkgs") {
cli.log(config.pkglist.join("\n"));
} else if (args[1] == "installed") {
cli.log(config.installed.join("\n"));
} else if (args[1] == "repos") {
var lerepos = "";
for (let index in config.repos) {
lerepos += "[" + index + "] " + config.repos[index] + "
";
}
cli.log(lerepos);
} else {
cli.log("ERR You must select either pkgs, installed, or repos.");
}
} else if (args[0] == "info") {
if (args.length > 2) {
cli.log("ERR No package specified.");
} else {
try {
var pkgInfo = await pkg93.pkgInfo(args[1]);
if (pkgInfo instanceof Error) {
// There's a Error in my pkgInfo!
throw pkgInfo;
}
if (!pkgInfo) {
cli.log("ERR Package not found.");
} else {
var description = pkgInfo.description ? pkgInfo.description : "None!";
var vers = pkgInfo.versions ? pkgInfo.versions.join(", ") : "None!";
cli.log(`${args[1]}
Description: ${description}
Versions: ${vers}`);
}
} catch (err) {
cli.log("ERR Error while getting package info.\n" + err.stack);
}
}
} else if (args[0] == "help") {
cli.log(help);
} else if (args[0] == "wtf") {
// for teh lulz
new Audio("/c/sys/sounds/QUACK.ogg").play();
var wtf = ["mudkipz", "pkg93", "memes", "linux", "javascript", "git", "cpu", "windows93", "discord", "kirb", "apt93", "delays", /* those last 2 go well together */ "trash", "kernel panic", "bash", "package manager", "recusion"];
cli.log("WTF? " + wtf[Math.floor(Math.random() * wtf.length)] + " + " + wtf[Math.floor(Math.random() * wtf.length)] + " = " + wtf[Math.floor(Math.random() * wtf.length)]);
} else {
cli.log("ERR Invalid command. Type \"pkg93\" without any arguments for help.");
}
}
export { _pkg93execdonotcallplsusetheapi };