Guest User

Untitled

a guest
Apr 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. class command(ABC):
  2. '''
  3. class all commands inherit from
  4. '''
  5.  
  6. @property
  7. @staticmethod
  8. @abstractmethod
  9. def name():
  10. '''
  11. returns the name of the command (which the parser acts on)
  12. '''
  13. pass
  14.  
  15. @property
  16. @staticmethod
  17. @abstractmethod
  18. def help():
  19. '''
  20. returns the help text
  21. '''
  22. pass
  23.  
  24. @property
  25. @staticmethod
  26. @abstractmethod
  27. def handle():
  28. '''
  29. contains the actual command handler, may return data
  30. '''
  31. pass
  32.  
  33. class commandPrint(command):
  34. '''
  35. example
  36. '''
  37.  
  38. @staticmethod
  39. def name():
  40. return 'print'
  41.  
  42. @staticmethod
  43. def help():
  44. return 'Print some string'
  45.  
  46. @staticmethod
  47. def handle(inputString):
  48. print(inputString)
  49. return inputString
Add Comment
Please, Sign In to add comment