2021-03-03 16:13:43 +00:00
|
|
|
import time
|
2021-03-08 01:56:00 +00:00
|
|
|
import sys
|
|
|
|
from consoleoutput import consoleTitle, clearConsole, printMainMenu, oColors
|
2021-03-08 21:13:57 +00:00
|
|
|
from plugin_downloader import searchPackage, getSpecificPackage
|
2021-03-08 01:56:00 +00:00
|
|
|
from plugin_updatechecker import updateInstalledPackage, checkInstalledPackage
|
2021-03-08 21:13:57 +00:00
|
|
|
from handle_config import checkConfig
|
|
|
|
from utilities import getHelp
|
2021-03-08 01:56:00 +00:00
|
|
|
|
|
|
|
def createInputLists():
|
|
|
|
global COMMANDLIST
|
|
|
|
COMMANDLIST = [
|
|
|
|
'get',
|
|
|
|
'update',
|
|
|
|
'check',
|
2021-03-08 21:13:57 +00:00
|
|
|
'exit',
|
|
|
|
'help'
|
2021-03-08 01:56:00 +00:00
|
|
|
]
|
|
|
|
global INPUTSELECTEDOBJECT
|
|
|
|
INPUTSELECTEDOBJECT = [
|
|
|
|
'all',
|
|
|
|
'*'
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def handleInput(inputCommand, inputSelectedObject, inputParams):
|
|
|
|
while True:
|
|
|
|
if inputCommand == 'get':
|
2021-03-08 21:13:57 +00:00
|
|
|
if inputSelectedObject.isdigit():
|
|
|
|
getSpecificPackage(inputSelectedObject, checkConfig().pathToPluginFolder, inputParams)
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
searchPackage(inputSelectedObject)
|
|
|
|
break
|
2021-03-08 01:56:00 +00:00
|
|
|
if inputCommand == 'update':
|
2021-03-08 21:13:57 +00:00
|
|
|
updateInstalledPackage(checkConfig().pathToPluginFolder, inputSelectedObject)
|
2021-03-08 01:56:00 +00:00
|
|
|
break
|
|
|
|
if inputCommand == 'check':
|
2021-03-08 21:13:57 +00:00
|
|
|
checkInstalledPackage(checkConfig().pathToPluginFolder, inputSelectedObject)
|
2021-03-08 01:56:00 +00:00
|
|
|
break
|
|
|
|
if inputCommand == 'exit':
|
|
|
|
sys.exit()
|
2021-03-08 21:13:57 +00:00
|
|
|
if inputCommand == 'help':
|
|
|
|
getHelp()
|
|
|
|
break
|
2021-03-08 01:56:00 +00:00
|
|
|
else:
|
|
|
|
print(oColors.brightRed + "Command not found. Please try again." + oColors.standardWhite)
|
|
|
|
getInput()
|
|
|
|
getInput()
|
2021-03-07 00:49:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
def getInput():
|
2021-03-08 01:56:00 +00:00
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
inputCommand, inputSelectedObject, *inputParams = input("pluGET >> ").split()
|
|
|
|
break
|
|
|
|
except ValueError:
|
|
|
|
print(oColors.brightRed + "Wrong input! Use: > *command* *selectedObject* *optionalParams*" + oColors.standardWhite)
|
|
|
|
|
|
|
|
inputParams = inputParams[0] if inputParams else None
|
2021-03-07 00:49:57 +00:00
|
|
|
print(inputCommand)
|
|
|
|
print(inputSelectedObject)
|
|
|
|
print(inputParams)
|
2021-03-08 01:56:00 +00:00
|
|
|
handleInput(inputCommand, inputSelectedObject, inputParams)
|
2021-03-03 16:13:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def inputMainMenu():
|
|
|
|
clearConsole()
|
2021-03-08 21:13:57 +00:00
|
|
|
checkConfig()
|
|
|
|
createInputLists()
|
2021-03-03 16:13:43 +00:00
|
|
|
printMainMenu()
|
2021-03-07 00:49:57 +00:00
|
|
|
getInput()
|
2021-03-03 16:13:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def outputTest():
|
|
|
|
print("Hello world")
|
|
|
|
print("Waiting still seconds: 5", end='\r')
|
|
|
|
time.sleep(1)
|
|
|
|
print("Waiting still seconds: 4", end='\r')
|
|
|
|
time.sleep(1)
|
|
|
|
print("Waiting still seconds: 3", end='\r')
|
|
|
|
time.sleep(1)
|
|
|
|
print("Waiting still seconds: 2", end='\r')
|
|
|
|
time.sleep(1)
|
|
|
|
print("Waiting still seconds: 1", end='\r')
|
|
|
|
time.sleep(1)
|
|
|
|
print("Done ✅☑✔ ")
|
|
|
|
input("Press key to end program...")
|
|
|
|
|
2021-03-07 00:49:57 +00:00
|
|
|
|
2021-03-03 16:13:43 +00:00
|
|
|
consoleTitle()
|
|
|
|
inputMainMenu()
|
2021-03-03 22:25:44 +00:00
|
|
|
outputTest()
|