+
+def prompt_variables_all(cdef, cread, cwrite, show_comments):
+ try:
+ for (category_id, (category, variables)) in cread.variables().items():
+ print(("========== Category = %s" % category_id.upper()))
+ for variable in list(variables.values()):
+ try:
+ newvar = prompt_variable(cdef, cread, cwrite, category, variable,
+ show_comments, True)
+ except Exception as inst:
+ if (str(inst) == 'NextCategory'):
+ break
+ else:
+ raise
+
+ except Exception as inst:
+ if (str(inst) == 'BailOut'):
+ return
+ else:
+ raise
+
+
+def prompt_variables_category(cdef, cread, cwrite, cid, show_comments):
+ cid = cid.lower()
+ CID = cid.upper()
+ try:
+ print(("========== Category = %s" % CID))
+ for vid in list_category(cdef, cid):
+ (category, variable) = cdef.locate_varname(vid.upper())
+ newvar = prompt_variable(cdef, cread, cwrite, category, variable,
+ show_comments, False)
+ except Exception as inst:
+ if (str(inst) == 'BailOut'):
+ return
+ else:
+ raise
+
+####################
+
+
+def show_variable(cdef, cread, cwrite,
+ category, variable, show_value, show_comments):
+ assert 'id' in category
+ assert 'id' in variable
+
+ category_id = category['id']
+ variable_id = variable['id']
+
+ default_value = get_value(cdef, category_id, variable_id)
+ current_value = get_current_value(cread, cwrite, category_id, variable_id)
+ varname = get_varname(cread, category_id, variable_id)
+ if show_comments:
+ print_name_comments(cdef, category_id, variable_id)
+ if show_value:
+ print("%s = %s" % (varname, current_value))
+ else:
+ print("%s" % (varname))
+
+
+def show_variables_all(cdef, cread, cwrite, show_value, show_comments):
+ for (category_id, (category, variables)) in cread.variables().items():
+ print(("========== Category = %s" % category_id.upper()))
+ for variable in list(variables.values()):
+ show_variable(cdef, cread, cwrite,
+ category, variable, show_value, show_comments)
+
+
+def show_variables_category(cdef, cread, cwrite, cid, show_value, show_comments):
+ cid = cid.lower()
+ CID = cid.upper()
+ print(("========== Category = %s" % CID))
+ for vid in list_category(cdef, cid):
+ (category, variable) = cdef.locate_varname(vid.upper())
+ show_variable(cdef, cread, cwrite, category, variable,
+ show_value, show_comments)
+
+####################
+re_mainloop_0arg = "^(?P<command>[uUwrRqlLsSeEcvVhH\?])[ \t]*$"
+re_mainloop_1arg = "^(?P<command>[sSeEvV])[ \t]+(?P<arg>\w+)$"
+matcher_mainloop_0arg = re.compile(re_mainloop_0arg)
+matcher_mainloop_1arg = re.compile(re_mainloop_1arg)
+
+
+def mainloop(cdef, cread, cwrite, default_config, site_config, consolidated_config):
+ global service