-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathSample2.cs
More file actions
28 lines (24 loc) · 882 Bytes
/
Sample2.cs
File metadata and controls
28 lines (24 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using InquirerCore;
using InquirerCore.Prompts;
using InquirerCore.Validators;
using System;
using System.Collections.Generic;
using System.Text;
namespace Samples.Basic
{
public static class Sample2
{
public static void Run()
{
var options = new string[] { "Option 1", "Option 2" };
var listInput = new ListInput("option", "Which option?", options);
var sureInput = new InputConfirmation("confirm", "Are you sure?");
var inquirer = new Inquirer(listInput, sureInput);
inquirer.Ask();
var answer = listInput.Answer();
Console.WriteLine($@"You have selected option: {answer} - {options[Int32.Parse(answer)-1]}");
Console.WriteLine(sureInput.Answer() == "y" ? "And you are sure!" : "And you are not sure!");
Console.ReadKey();
}
}
}