Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class command(ABC):
- '''
- class all commands inherit from
- '''
- @property
- @staticmethod
- @abstractmethod
- def name():
- '''
- returns the name of the command (which the parser acts on)
- '''
- pass
- @property
- @staticmethod
- @abstractmethod
- def help():
- '''
- returns the help text
- '''
- pass
- @property
- @staticmethod
- @abstractmethod
- def handle():
- '''
- contains the actual command handler, may return data
- '''
- pass
- class commandPrint(command):
- '''
- example
- '''
- @staticmethod
- def name():
- return 'print'
- @staticmethod
- def help():
- return 'Print some string'
- @staticmethod
- def handle(inputString):
- print(inputString)
- return inputString
Add Comment
Please, Sign In to add comment