diff --git a/packages/pakk.conf b/packages/pakk.conf index 32a4829..d667610 100644 --- a/packages/pakk.conf +++ b/packages/pakk.conf @@ -1 +1 @@ -[['builtin', 'packages.builtin', ['echo', 'ls', 'rm', 'clear', 'cd', 'll']]] \ No newline at end of file +[['builtin', 'packages.builtin', ['echo', 'ls', 'rm', 'clear', 'cd', 'll']], ['upd', 'packages.update', ['upd']]] \ No newline at end of file diff --git a/packages/update.py b/packages/update.py index 5c851a6..d6113f4 100644 --- a/packages/update.py +++ b/packages/update.py @@ -1,22 +1,23 @@ -# -*- coding: utf-8 -*- -#["pip", "packages.pip", ["pip"]] +#["upd", "packages.update", ["upd"]] # Made By Blurple -import os, sys +import os, sys, requests +fileList = [ + "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/builtin.py", + "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/echo.py", + "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/nano.py", + "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/netget.py", + "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/pip.py", + "https://raw.githubusercontent.com/OusmBlueNinja/TermPY/main/packages/upd.py" +] -def pip(command: list): - - print(command, len(command)) - if len(command) != 1: - print("comand requires [ package_name ] [ args (optional) ] ") - return - - package = command[0] - try: - from pip._internal import main as pipmain - pipmain(['install', {package}]) - except ImportError: - os.system(f"pip install {package}") - - except: - print("cannot download") \ No newline at end of file +def upd(command): + input(f"Settings: {fileList}, {os.path.dirname(os.path.realpath(__file__))}\nPress enter to continue") + for url in fileList: + r = requests.get(url) + if 'Requests:' in r.text: + print(r.text) + print(r.headers['Content-Type']) + fileInstallingCreator = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.basename(url)) + with open(fileInstallingCreator, "w") as newFile: + newFile.write(r.text)