def __get_current_value(settings, key): text = FormattedText() value = settings.get(key) if value is None: text.italic("No value") else: text.code_block(value) if not settings.is_set(key): text.newline().italic("(default)") return text
def __get_current_value(state, key): text = FormattedText() current_value = state.get_value(key) if current_value is not None: text.code_block(str(current_value)) elif state.exists_value(key): keys = state.get_for(key).list_keys() formatted_keys = "\n".join(sorted(keys)) text.italic("Key is a node.").newline().italic( "Child keys:").newline().code_block(formatted_keys) else: text.italic("Key does not exists") return text