MCPcopy
hub / github.com/RUB-NDS/PRET / do_set

Method do_set

postscript.py:1065–1083  ·  view source on GitHub ↗

Set key to value in topmost dictionary: set

(self, arg)

Source from the content-addressed store, hash-verified

1063
1064 # ------------------------[ set <key=value> ]-------------------------
1065 def do_set(self, arg):
1066 "Set key to value in topmost dictionary: set <key=value>"
1067 arg = re.split("=", arg, 1)
1068 if len(arg) > 1:
1069 key, val = arg
1070 # make changes permanent
1071 str_send = 'true 0 startjob {\n'
1072 # flavor No.1: put (associate key with value in dict)
1073 str_send += '/' + key + \
1074 ' where {/' + key + ' ' + val + ' put} if\n'
1075 # flavor No.2: store (replace topmost definition of key)
1076 str_send += '/' + key + ' ' + val + ' store\n'
1077 # flavor No.3: def (associate key and value in userdict)
1078 str_send += '/' + key + ' ' + val + ' def\n'
1079 # ignore invalid access
1080 str_send += '} 1183615869 internaldict /superexec get exec'
1081 self.cmd(str_send, False)
1082 else:
1083 self.onecmd("help set")
1084
1085 # ------------------------[ config <setting> ]------------------------
1086 def do_config(self, arg):

Callers

nothing calls this directly

Calls 2

cmdMethod · 0.95
onecmdMethod · 0.80

Tested by

no test coverage detected