TclCommandGetSys.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from tclCommands.TclCommand import *
  2. class TclCommandGetSys(TclCommand):
  3. """
  4. Tcl shell command to get the value of a system variable
  5. example:
  6. get_sys excellon_zeros
  7. """
  8. # List of all command aliases, to be able use old names for backward compatibility (add_poly, add_polygon)
  9. aliases = ['get_sys', 'getsys']
  10. # Dictionary of types from Tcl command, needs to be ordered
  11. arg_names = collections.OrderedDict([
  12. ('name', str)
  13. ])
  14. # Dictionary of types from Tcl command, needs to be ordered , this is for options like -optionname value
  15. option_types = collections.OrderedDict([
  16. ])
  17. # array of mandatory options for current Tcl command: required = {'name','outname'}
  18. required = ['name']
  19. # structured help for current command, args needs to be ordered
  20. help = {
  21. 'main': "Returns the value of the system variable.",
  22. 'args': collections.OrderedDict([
  23. ('name', 'Name of the system variable.'),
  24. ]),
  25. 'examples': ['get_sys excellon_zeros']
  26. }
  27. def execute(self, args, unnamed_args):
  28. """
  29. :param args:
  30. :param unnamed_args:
  31. :return:
  32. """
  33. name = args['name']
  34. if name in self.app.defaults:
  35. return self.app.defaults[name]