|
@@ -326,6 +326,26 @@ String function cmd_read_attrs(model : Element, element_name : String):
|
|
|
else:
|
|
|
return "Element not found: " + element_name!
|
|
|
|
|
|
+String function cmd_read_defined_attrs(model : Element, element_name : String):
|
|
|
+ String result
|
|
|
+ Element attr_list
|
|
|
+ Element attr_keys
|
|
|
+ String attr_key
|
|
|
+
|
|
|
+ result = "Success: "
|
|
|
+ if (dict_in(model["model"], element_name)):
|
|
|
+ attr_list = getInstantiatableAttributes(model, element_name, "AttributeLink")
|
|
|
+ attr_keys = dict_keys(attr_list)
|
|
|
+ while (0 < set_len(attr_keys)):
|
|
|
+ attr_key = set_pop(attr_keys)
|
|
|
+ if (value_eq(read_attribute(model, reverseKeyLookup(model["model"], dict_read_edge(model["model"][element_name], attr_key)), "optional"), True)):
|
|
|
+ result = string_join(result, attr_key) + " ?: " + cast_v2s(attr_list[attr_key]) + "\n"
|
|
|
+ else:
|
|
|
+ result = string_join(result, attr_key) + " : " + cast_v2s(attr_list[attr_key]) + "\n"
|
|
|
+ return result!
|
|
|
+ else:
|
|
|
+ return "Element not found: " + element_name!
|
|
|
+
|
|
|
String function cmd_types(model : Element):
|
|
|
Element keys_t
|
|
|
String v_t
|
|
@@ -425,6 +445,8 @@ Element function modify(model : Element, write : Boolean):
|
|
|
output(cmd_read(model, single_input("Name?")))
|
|
|
elif (cmd == "read_attrs"):
|
|
|
output(cmd_read_attrs(model, single_input("Name?")))
|
|
|
+ elif (cmd == "read_defined_attrs"):
|
|
|
+ output(cmd_read_defined_attrs(model, single_input("Name?")))
|
|
|
elif (cmd == "types"):
|
|
|
output(cmd_types(model))
|
|
|
elif (cmd == "retype"):
|