blob: 2a07708350ce01d3d7a813b58cc225c7639f8bde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// file : libbutl/prompt.hxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
#pragma once
#include <string>
#include <libbutl/export.hxx>
namespace butl
{
// The Y/N prompt. The def argument, if specified, should be either 'y' or
// 'n'. It is used as the default answer, in case the user just hits enter.
//
// Write the prompt to diag_stream. Throw ios_base::failure if no answer
// could be extracted from stdin (for example, because it was closed).
//
// Note that the implementation accepts both lower and upper case y/n as
// valid answers (apparently the capitalized default answer confuses some
// users into answering with capital letters).
//
LIBBUTL_SYMEXPORT bool
yn_prompt (const std::string&, char def = '\0');
}
|