'I want to add back option in multiple inquirer list
Below is the code for reference. I want to set a back option for the previous menu or it is possible to set Ctrl + c for the previous menu. Any help would be appreciated. Thanks in advance.
Python version - 3.8.10
import inquirer
def cont():
questions = [
inquirer.List('Choice',
message="Do you want continue ?",
choices=['YES', 'NO'],)]
answers = inquirer.prompt(questions)
if answers['Choice'] == 'NO':
return False
return True
while True:
questions = [
inquirer.List('Function',
message="Select the function",
choices=['NRF','NSSF','AMF'],
),
]
answers = inquirer.prompt(questions)
print (answers["Function"])
if answers["Function"] == 'NRF':
questions = [
inquirer.List('NRF',
message="Select the NRF",
choices=['NF_Management','NF_Discovery','Access_Token(OAuth2)'],),]
answers = inquirer.prompt(questions)
print (answers["NRF"])
if answers["NRF"] == 'NF_Management' :
questions = [
inquirer.List('NF_Management',
message="Select the NF_Management",
choices=['NF_Instances(Store)','NF_Instances_ID(Document)','Subscriptions(Collection)','Subscriptions(Document)'],),]
answers = inquirer.prompt(questions)
print (answers["NF_Management"])
if answers["NF_Management"] == 'NF_Instances(Store)' :
questions = [
inquirer.List('NF_Instances(Store)',
message="Select the NF_Instances(Store)",
choices=['Retrieve_NF_List','Query_Options'],),]
answers = inquirer.prompt(questions)
print (answers["NF_Instances(Store)"])
if not cont():
break
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|