Skip to content

Commit

Permalink
v1.1
Browse files Browse the repository at this point in the history
- Add compressor
  • Loading branch information
MitchellShibilski-Unkel committed Apr 19, 2024
1 parent 697f28a commit dbb9563
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
19 changes: 19 additions & 0 deletions src/compressor/compressor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import zlib


class MunixCompressor:
def __init__(self, file: str, compressionLevel = "High"):
self.file = file
self.level = compressionLevel

def compress(self):
match self.level:
case "Low":
zlib.compress(self.file, level=1)
case "Medium":
zlib.compress(self.file, level=4)
case "High":
zlib.compress(self.file, level=9)

def decompress(self):
zlib.decompress(self.file)
13 changes: 9 additions & 4 deletions src/terminal/terminal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from src.compressor.compressor import MunixCompressor


class MunixCMD:
Expand Down Expand Up @@ -36,10 +37,14 @@ def run(self, cmd: str):
print(os.system(f"python {breakDown[1]}"))
elif breakDown[0] in "compile":
print(os.system(f"gcc {breakDown[1]} -o {breakDown[2]}\n"))
elif breakDown[0] in "clone":
print(os.system(f"gh repo clone {breakDown[1]}\n"))
elif breakDown[0] in "compress":
MunixCompressor(breakDown[1:]).compress()
print(f"{breakDown[1:]} Compressed\n")
elif breakDown[0] in "decompress":
MunixCompressor(breakDown[1:]).decompress()
print(f"{breakDown[1:]} Decompressed\n")
elif breakDown[0] in "help" or breakDown[0] in "-h":
print("Command Name\tFunction\tCommand\nr\tRead\tr [FILE]\nw\tWrite\tw [FILE]\nf\tFind\tf [FILE]\ncompile\tGCC Compiler\tcompile [FILE] [EXE NAME]\nprint\tEcho\tprint [MESSAGE]\nget\tInstaller\tget [-py *OPTIONAL] [NAME]\nupdate\tUpdater\tupdate [NAME]\nremove\tUninstaller\tremove [NAME]\nclone\tGitHub Repo Cloner\tclone [REPO]\n")
print("Command Name\tFunction\tCommand\nr\tRead\tr [FILE]\nw\tWrite\tw [FILE]\nf\tFind\tf [FILE]\ncompile\tGCC Compiler\tcompile [FILE] [EXE NAME]\nprint\tEcho\tprint [MESSAGE]\nget\tInstaller\tget [-py *OPTIONAL] [NAME]\nupdate\tUpdater\tupdate [NAME]\nremove\tUninstaller\tremove [NAME]\ncompress\tCompressor\tcompress [FILE]\ndecompress\tDecompressor\tdecompress [FILE]\n")
else:
print("CMD ERROR (1) :: Command Does Not Exist\n")

Expand All @@ -48,4 +53,4 @@ def __count__(self, x: list):
for x2 in x:
count += 1

return count
return count

0 comments on commit dbb9563

Please sign in to comment.