From 08c1d1b95f216bc3bd4131b8967fab4590baa391 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 2 Apr 2018 20:58:41 +0100 Subject: add ls --- pkg93.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg93.js b/pkg93.js index 1bef15f..398ac26 100644 --- a/pkg93.js +++ b/pkg93.js @@ -58,7 +58,7 @@ le._apps.pkg93 = { exec: function() { const protected = ["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"]; const args = this.arg.arguments; - const version = "v0.1.0"; + const version = "v1.0.0"; if (localStorage[".pkg93/config.json"] === undefined) { localStorage[".pkg93/config.json"] = '{"repos": ["http://codinggamerhd.com/main-repo"], "installed": [], "pkglist": []}'; } @@ -154,6 +154,7 @@ pkg93 rm kebab $log("ERR Already removed."); } else { le._apps[config.installed[index]] = null; + config.installed = config.installed.splice(index, 1); $log("OK Removed!"); } } catch (err) { @@ -164,17 +165,27 @@ pkg93 rm kebab } else if (args[0] == "add-repo") { try { config.repos.push(args[1]); // well, that was easy - $log("OK Done!"); + $log("OK Done!\n Run \"pkg93 pull\" to update the package listing."); } catch (err) { $log("ERR " + err.message); } } else if (args[0] == "rm-repo") { try { config.repos = config.repos.splice(parseInt(args[1]), 1); - $log("OK Done!"); + $log("OK Done!\n Run \"pkg93 pull\" to update the package listing."); } catch (err) { $log("ERR " + err.message); } + } else if (args[0] == "ls") { + if (args[1] == "pkgs") { + $log(config.pkglist.join("\n")); + } else if (args[1] == "installed") { + $log(config.installed.join("\n")); + } else if (args[1] == "repos") { + $log(config.repos.join("\n")); + } else { + $log("ERR You must select either pkgs, installed, or repos."); + } } else { $log("ERR Invalid command. Type \"pkg93\" without any arguments for help."); } -- cgit v1.2.3