2022-06-03 22:08:10 +00:00
|
|
|
"""
|
2022-06-16 15:05:40 +00:00
|
|
|
Handles the main function and the argument passing for the whole pluGET program
|
2022-06-03 22:08:10 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
import sys
|
2022-06-07 20:40:27 +00:00
|
|
|
import argparse
|
2022-06-02 17:52:49 +00:00
|
|
|
|
2022-06-03 22:08:10 +00:00
|
|
|
# check if folder 'src' is accessible with all modules needed and if not exit
|
|
|
|
try:
|
2022-06-16 19:26:43 +00:00
|
|
|
from src.handlers.handle_config import check_config, validate_config
|
2022-06-20 15:21:58 +00:00
|
|
|
from src.utils.console_output import rename_console_title, clear_console, print_logo, print_console_logo
|
|
|
|
from src.utils.utilities import check_requirements, api_test_spiget, check_for_pluGET_update
|
2022-06-16 19:26:43 +00:00
|
|
|
from src.handlers.handle_input import handle_input
|
2022-06-20 15:21:58 +00:00
|
|
|
except TypeError:
|
2022-06-16 20:35:54 +00:00
|
|
|
print("Folder 'src' not found in the directory or missing files or broken functions detected! \
|
2022-06-16 19:26:43 +00:00
|
|
|
\nPlease redownload the files from here: https://www.github.com/Neocky/pluGET")
|
|
|
|
sys.exit()
|
2022-06-02 17:52:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-06-16 19:26:43 +00:00
|
|
|
parser = argparse.ArgumentParser(description="Arguments for pluGET",
|
2022-06-02 17:52:49 +00:00
|
|
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
2022-06-16 20:35:54 +00:00
|
|
|
parser.add_argument("mode", help="Mode (install/update/etc.)", nargs='?', default=None)
|
2022-06-16 19:26:43 +00:00
|
|
|
parser.add_argument("object", help="Object/Plugin Name", nargs='?', default=None)
|
|
|
|
parser.add_argument("version", help="Version", nargs='?', default=None)
|
2022-06-22 10:58:48 +00:00
|
|
|
parser.add_argument("--no-confirmation", action="store_true", help="Skip confirmation messages")
|
2022-06-16 19:26:43 +00:00
|
|
|
args = vars(parser.parse_args())
|
2022-06-20 15:21:58 +00:00
|
|
|
|
|
|
|
rename_console_title()
|
|
|
|
check_config()
|
|
|
|
validate_config()
|
|
|
|
api_test_spiget()
|
|
|
|
check_requirements()
|
|
|
|
|
2022-06-16 19:26:43 +00:00
|
|
|
if args["mode"] is not None and args["object"] is not None:
|
|
|
|
# arguments were used so call the handle_input function to get the right function call
|
2022-06-20 15:21:58 +00:00
|
|
|
print_console_logo()
|
|
|
|
check_for_pluGET_update()
|
2022-06-22 10:58:48 +00:00
|
|
|
handle_input(args["mode"], args["object"], args["version"], args["no_confirmation"], arguments_from_console=True)
|
2022-06-16 19:26:43 +00:00
|
|
|
else:
|
|
|
|
# no arguments were used so start pluGET console
|
2022-06-21 07:57:52 +00:00
|
|
|
clear_console()
|
2022-06-16 19:26:43 +00:00
|
|
|
print_logo()
|
2022-06-20 15:21:58 +00:00
|
|
|
check_for_pluGET_update()
|
2022-06-16 19:26:43 +00:00
|
|
|
handle_input()
|