diff --git a/internal/extra.py b/internal/extra.py index 75336b3..dab0a0f 100644 --- a/internal/extra.py +++ b/internal/extra.py @@ -10,7 +10,7 @@ class notes: name = ("PyOS") - ver = ("3.0-base-master") + ver = ("3.1-base-master") author = ("Prouser123") helpmsg = ("Type 'help' for a list of commands.") diff --git a/internal/runCommand.py b/internal/runCommand.py index 1af2b2b..9de6243 100644 --- a/internal/runCommand.py +++ b/internal/runCommand.py @@ -1,26 +1,10 @@ -# PyOS -# Made for Python 2.7 -# internal/runCommand.py - -# Import Libraries - import sys -# PyOS Scripts + import internal.extra import internal.update.runscript -# External Programs -import programs.calculator -import programs.sysinfo -import programs.example -import programs.fizzbuzz -import programs.ls -import programs.pwd -import programs.cp -import programs.mv -import programs.mkdir -import programs.downloader -import programs.snake -import programs.showallcolors + +# Import programs (see programs/__init__.py) +import programs # Setup colors import internal.colors diff --git a/main.py b/main.py index 516aa0a..76f6872 100644 --- a/main.py +++ b/main.py @@ -45,6 +45,7 @@ def cmd_loop(): #print(internal.extra.colors.BOLD + internal.extra.notes.name + " " + internal.extra.notes.ver + " - " + internal.extra.colors.WARNING + "Made for Python 2.7" + internal.extra.colors.ENDC) print(Colors.Bold(internal.extra.notes.name + " " + internal.extra.notes.ver + " - ") + Colors.Warning("Made for Python 2.7")) # Print python version -print ("Running on Python " + internal.extra.system.pyVer) +print("Running on Python " + internal.extra.system.pyVer) +print(str(len(internal.runCommand.getValidCommands())) + " programs detected.") print(internal.extra.notes.helpmsg) cmd_loop() diff --git a/programs/__init__.py b/programs/__init__.py index e69de29..4a6fe34 100644 --- a/programs/__init__.py +++ b/programs/__init__.py @@ -0,0 +1,10 @@ +from importlib import import_module as __import_module +from os import path as __path + +import glob as __glob + +__modules = __glob.glob(__path.join(__path.dirname(__file__), "*.py")) +__files = [ __path.basename(__f)[:-3] for __f in __modules if __path.isfile(__f) and not __f.endswith('__init__.py')] + +for __i in __files: + __import_module('.' + __i, __name__) \ No newline at end of file