From 726f4573a5d183a685e0a1032a3e247e3b47482e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 7 Jul 2018 12:34:08 +0200 Subject: Move prompt facility from bpkg to libbutl --- libbutl/prompt.mxx | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 libbutl/prompt.mxx (limited to 'libbutl/prompt.mxx') diff --git a/libbutl/prompt.mxx b/libbutl/prompt.mxx new file mode 100644 index 0000000..5d431a6 --- /dev/null +++ b/libbutl/prompt.mxx @@ -0,0 +1,36 @@ +// file : libbutl/prompt.mxx -*- C++ -*- +// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef __cpp_modules +#pragma once +#endif + +// C includes. + +#ifndef __cpp_lib_modules +#include +#endif + +// Other includes. + +#ifdef __cpp_modules +export module butl.prompt; +#ifdef __cpp_lib_modules +import std.core; +#endif +#endif + +#include + +LIBBUTL_MODEXPORT 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). + // + LIBBUTL_SYMEXPORT bool + yn_prompt (const std::string&, char def = '\0'); +} -- cgit v1.1