- Added framework for readline support.
This commit is contained in:
Paul Beckingham 2014-06-19 17:37:21 -04:00
parent aacae1b1c6
commit e559f49cd2

View file

@ -29,14 +29,37 @@
#include <cstring>
#include <i18n.h>
#ifdef HAVE_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
////////////////////////////////////////////////////////////////////////////////
static int commandLoop ()
{
// TODO Display prompt
// TODO Wait for input
// TODO Dispatch command
// TODO Compose prompt.
std::string prompt = "task> ";
return 0;
// Display prompt, get input.
char *line_read = readline (prompt.c_str ());
if (! line_read)
return 1;
// Save history.
if (*line_read)
add_history (line_read);
std::string command (line_read);
free (line_read);
// TODO Dispatch command
int status = 0;
if (command == "exit") status = 1;
// TODO diagnostics
// TODO help
return status;
}
////////////////////////////////////////////////////////////////////////////////