mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-18 00:35:36 +00:00
Minor update
This commit is contained in:
parent
8c962e5e26
commit
5244a1debd
@ -1 +1,9 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Developed by KuiToi Dev
|
||||||
|
# File modules.console.__init__.py
|
||||||
|
# Written by: SantaSpeen
|
||||||
|
# Version 1.0
|
||||||
|
# Licence: FPA
|
||||||
|
# (c) kuitoi.su 2023
|
||||||
from .console import Console
|
from .console import Console
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Developed by KuiToi Dev
|
||||||
|
# File core.config_provider.py
|
||||||
|
# Written by: SantaSpeen
|
||||||
|
# Version 1.1
|
||||||
|
# Licence: FPA
|
||||||
|
# (c) kuitoi.su 2023
|
||||||
import asyncio
|
import asyncio
|
||||||
import builtins
|
import builtins
|
||||||
import logging
|
import logging
|
||||||
@ -27,7 +35,8 @@ class Console:
|
|||||||
self.__man = dict()
|
self.__man = dict()
|
||||||
self.__desc = dict()
|
self.__desc = dict()
|
||||||
self.add_command("man", self.__create_man_message, "man - display the manual page.\n"
|
self.add_command("man", self.__create_man_message, "man - display the manual page.\n"
|
||||||
"Usage: man COMMAND", "Display the manual page")
|
"Usage: man COMMAND", "Display the manual page",
|
||||||
|
custom_completer={"man": {}})
|
||||||
self.add_command("help", self.__create_help_message,
|
self.add_command("help", self.__create_help_message,
|
||||||
"help - display names and brief descriptions of available commands.\n"
|
"help - display names and brief descriptions of available commands.\n"
|
||||||
"Usage: help [--raw]\n"
|
"Usage: help [--raw]\n"
|
||||||
@ -108,6 +117,7 @@ class Console:
|
|||||||
raise TypeError("key must be string")
|
raise TypeError("key must be string")
|
||||||
self.__debug(f"added user command: key={key}; func={func};")
|
self.__debug(f"added user command: key={key}; func={func};")
|
||||||
self.__alias.update(custom_completer or {key: None})
|
self.__alias.update(custom_completer or {key: None})
|
||||||
|
self.__alias["man"].update({key: None})
|
||||||
self.__func.update({key: {"f": func}})
|
self.__func.update({key: {"f": func}})
|
||||||
self.__man.update({key: f'html<seagreen>Manual for command <b>{key}</b>\n{man}</seagreen>' if man else None})
|
self.__man.update({key: f'html<seagreen>Manual for command <b>{key}</b>\n{man}</seagreen>' if man else None})
|
||||||
self.__desc.update({key: desc})
|
self.__desc.update({key: desc})
|
||||||
@ -193,12 +203,18 @@ class Console:
|
|||||||
else:
|
else:
|
||||||
self.log(self.__not_found % cmd)
|
self.log(self.__not_found % cmd)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
break
|
raise KeyboardInterrupt
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error in console.py: {e}")
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
self.__is_run = True
|
self.__is_run = True
|
||||||
await self.read_input()
|
await self.read_input()
|
||||||
|
|
||||||
|
def stop(self, *args, **kwargs):
|
||||||
|
self.__is_run = False
|
||||||
|
raise KeyboardInterrupt
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
c = Console()
|
c = Console()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user