2021-03-08 01:56:00 +00:00
|
|
|
import sys
|
2021-03-12 00:39:39 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
from utils.consoleoutput import oColors
|
|
|
|
from utils.utilities import getHelp
|
|
|
|
from handlers.handle_config import checkConfig
|
|
|
|
from plugin.plugin_downloader import searchPackage, getSpecificPackage
|
|
|
|
from plugin.plugin_updatechecker import updateInstalledPackage, checkInstalledPackage
|
|
|
|
from plugin.plugin_remover import removePlugin
|
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',
|
2021-03-10 22:49:57 +00:00
|
|
|
'help',
|
|
|
|
'remove'
|
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():
|
2021-03-10 01:05:56 +00:00
|
|
|
if not checkConfig().localPluginFolder:
|
|
|
|
getSpecificPackage(inputSelectedObject, checkConfig().sftp_folderPath, inputParams)
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
getSpecificPackage(inputSelectedObject, checkConfig().pathToPluginFolder, inputParams)
|
2021-03-12 00:39:39 +00:00
|
|
|
break
|
2021-03-08 21:13:57 +00:00
|
|
|
else:
|
|
|
|
searchPackage(inputSelectedObject)
|
|
|
|
break
|
2021-03-08 01:56:00 +00:00
|
|
|
if inputCommand == 'update':
|
2021-03-10 01:05:56 +00:00
|
|
|
updateInstalledPackage(inputSelectedObject)
|
2021-03-08 01:56:00 +00:00
|
|
|
break
|
|
|
|
if inputCommand == 'check':
|
2021-03-10 01:05:56 +00:00
|
|
|
checkInstalledPackage(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-10 22:49:57 +00:00
|
|
|
if inputCommand == 'remove':
|
|
|
|
removePlugin(inputSelectedObject)
|
2021-03-10 01:05:56 +00:00
|
|
|
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-13 18:21:03 +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
|
|
|
|
|
|
|
|
2021-03-12 00:39:39 +00:00
|
|
|
# only for testing purposes
|
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...")
|