in modular_cli/modular_cli_autocomplete/modular_cli_complete.py [0:0]
def format_response(suggestions):
help_file = os.path.join(str(Path.home()), HELP_FILE)
if isinstance(suggestions, list):
with open(help_file, 'w+') as result_file:
result_file.write(f'{os.linesep}'.join(sorted(suggestions)))
exit(0)
if isinstance(suggestions, str):
with open(help_file, 'w+') as result_file:
for each in suggestions:
result_file.write(each)
exit(0)
suggestions = dict(sorted(suggestions.items()))
response_array = []
for key, value in suggestions.items():
response_array.append(key)
response_str = f'{os.linesep}'.join(response_array)
with open(help_file, 'w+') as result_file:
result_file.write(response_str)
sys.exit(0)