#include <cmake.h>
#include <iostream>
+#include <vector>
+#include <string>
#include <../Sarge/src/sarge.h>
#include <stdlib.h>
using namespace std;
std::string promptCompose();
+static std::vector <std::string> contexts;
+std::string composeContexts (bool pretty = false);
+
+int promptClear ()
+{
+ contexts.clear ();
+ return 0;
+}
+
+int promptRemove ()
+{
+ if (contexts.size ())
+ contexts.pop_back ();
+
+ return 0;
+}
+
+int promptAdd (const std::string& context)
+{
+ contexts.push_back (context);
+ return 0;
+}
+
+std::string promptCompose ()
+{
+ return "% ";
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
const std::string getResponse(const std::string & prompt) {
std::string response {
""
};
- // Display prompt, get input.
+ // Display prompt, get input
#ifdef HAVE_READLINE
char * line_read = readline(prompt.c_str());
if (!line_read) {
std::cout << "\n";
response = "<EOF>";
} else {
- // Save history.
+ // Save history
if ( * line_read)
add_history(line_read);
// Main program
while (true) {
- // Compose the prompt.
+ // Compose the prompt
auto prompt = promptCompose();
- // Display prompt, get input.
+ // Display prompt, get input
auto command = getResponse(prompt);
if (command != "")
{
- // Dispatch command.
+ // Dispatch command
if (command == "<EOF>")
{
return 0;