Difficult-Rocket/Difficult_Rocket/command/tree.py

75 lines
1.7 KiB
Python
Raw Normal View History

2021-11-06 19:07:32 +08:00
# -------------------------------
# Difficult Rocket
2022-06-27 16:51:14 +08:00
# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com
2021-11-06 19:07:32 +08:00
# All rights reserved
# -------------------------------
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
github: @shenjackyuanjie
gitee: @shenjackyuanjie
"""
2022-08-29 13:21:47 +08:00
from Difficult_Rocket import DR_runtime
2022-02-07 22:14:51 +08:00
from Difficult_Rocket.command import line
2022-05-11 11:11:39 +08:00
COMMAND = 'command'
SUB_COMMAND = 'sub_command'
INFO = 'info'
RUN = 'run'
2022-02-07 22:14:51 +08:00
2022-05-11 11:11:39 +08:00
DR_command = {
2022-09-04 13:53:09 +08:00
'name': 'DR-root',
2022-08-29 13:21:47 +08:00
'version': DR_runtime.DR_version,
2022-09-04 13:53:09 +08:00
INFO: 'DR的自带命令解析树',
COMMAND: {
INFO: '这里是DR的根命令节点',
RUN: None,
2022-05-11 11:11:39 +08:00
SUB_COMMAND: {
2022-09-04 13:53:09 +08:00
'stop': {
2022-05-11 11:11:39 +08:00
INFO: '退出游戏',
2022-09-04 13:53:09 +08:00
RUN: None
2022-02-07 22:14:51 +08:00
},
2022-09-04 13:53:09 +08:00
'fps': {
INFO: 'FPS相关命令',
RUN: None,
2022-05-11 11:11:39 +08:00
SUB_COMMAND: {
'log': {
INFO: '输出FPS信息',
2022-09-04 13:53:09 +08:00
RUN: None
2022-02-07 22:14:51 +08:00
},
2022-05-11 11:11:39 +08:00
'min': {
INFO: '输出一段时间内最小fps',
2022-09-04 13:53:09 +08:00
RUN: None
2022-02-07 22:14:51 +08:00
},
2022-05-11 11:11:39 +08:00
'max': {
INFO: '输出一段时间内最大FPS',
2022-09-04 13:53:09 +08:00
RUN: None
2022-02-07 22:14:51 +08:00
}
}
2022-05-11 11:11:39 +08:00
},
'default': {
INFO: '重置一些设置'
2022-02-07 22:14:51 +08:00
}
}
}
}
2022-05-11 11:11:39 +08:00
2022-10-11 21:53:44 +08:00
"""
abc <a> abc -> abc()
abc a abc -> bbb()
abc -> help('abc')
"""
2022-04-30 13:56:57 +08:00
# TODO 给爷做了他
2021-11-06 19:07:32 +08:00
class CommandTree:
def __init__(self, command_tree_dict):
self.command_tree_dict = command_tree_dict
2022-05-11 11:11:39 +08:00
def parse(self, command: [line.CommandText, str]):
2021-11-06 19:07:32 +08:00
pass