prompter_mh 0.0.1 prompter_mh: ^0.0.1 copied to clipboard
Library to create CLI wizards
import 'package:prompter_mh/prompter_mh.dart';
void main() {
// Instantiate a prompter instance
Prompter prompter = Prompter();
// Generate your list of propmts with emphasis on the prompt type
var prompts = [
{
'prompt': 'What Color Do You Want?',
'type': 'multiple',
'options': <Option>[
Option(label: 'I want red', value: '#f44141'),
Option(label: 'I want blue', value: '#4158f4'),
Option(label: 'I want green', value: '#42f47d'),
Option(label: 'I want yellow', value: '#f4f441'),
]
},
{
'prompt': 'Do you like banana?',
'type': 'binary',
},
{
'prompt': 'What is your name?',
'type': 'text',
}
];
// Ask the prompter all your questions
prompts.forEach((prompt) {
prompter.ask(prompt['prompt'], prompt['type'], prompt['options']);
});
print(prompter.result());
}