-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.py
More file actions
62 lines (46 loc) · 2.55 KB
/
main.py
File metadata and controls
62 lines (46 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from Source.Core.SystemObjects import SystemObjects
from Source.CLI.Descriptions import CommandsList
from Source.CLI import Commands
from dublib.Methods.System import CheckPythonMinimalVersion
from dublib.CLI.Terminalyzer import Terminalyzer
import sys
#==========================================================================================#
# >>>>> ИНИЦИАЛИЗАЦИЯ <<<<< #
#==========================================================================================#
CheckPythonMinimalVersion(3, 10)
#==========================================================================================#
# >>>>> НАСТРОЙКА ОБРАБОТЧИКА КОМАНД <<<<< #
#==========================================================================================#
Analyzer = Terminalyzer()
Objects = SystemObjects()
Analyzer.helper.enable()
CommandDataStruct = Analyzer.check_commands(CommandsList)
Objects.logger.info(f"Running with Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} on {sys.platform}.", stdout = False)
Objects.logger.info("Command: \"" + " ".join(sys.argv[1:len(sys.argv)]) + "\".", stdout = False)
if CommandDataStruct == None:
Objects.logger.error("Unknown command!")
Objects.logger.set_rule(3)
Objects.logger.close()
exit()
elif CommandDataStruct.name in ("help", "list", "tagger"): Objects.LIVE_MODE.enable()
if not Objects.LIVE_MODE:
if "f" in CommandDataStruct.flags: Objects.FORCE_MODE.enable()
if Objects.MELON_VERSION: print(f"Melon: {Objects.MELON_VERSION.tag}")
Objects.logger.templates.OptionStatus("Force mode", Objects.FORCE_MODE.status)
Objects.logger.templates.OptionStatus("Caching", Objects.CACHING.status)
#==========================================================================================#
# >>>>> ОБРАБОТКА КОММАНД <<<<< #
#==========================================================================================#
try:
Objects.logger.select_cli_point(CommandDataStruct.name)
if CommandDataStruct.check_key("use"): Objects.select_parser(CommandDataStruct.get_key_value("use"))
CommandName = CommandDataStruct.name.replace("-", "_")
Commands
exec(f"Commands.com_{CommandName}(Objects, CommandDataStruct)")
except KeyboardInterrupt: pass
#==========================================================================================#
# >>>>> ЗАВЕРШЕНИЕ РАБОТЫ <<<<< #
#==========================================================================================#
if not Objects.LIVE_MODE: Objects.logger.header("End")
Objects.logger.close()
exit(Objects.EXIT_CODE)