diff --git a/include/fc/rpc/cli.hpp b/include/fc/rpc/cli.hpp index f4bb7a5..d6d9d11 100644 --- a/include/fc/rpc/cli.hpp +++ b/include/fc/rpc/cli.hpp @@ -53,16 +53,18 @@ namespace fc { namespace rpc { virtual void getline( const fc::string& prompt, fc::string& line ); + void set_prompt( const string& prompt ) { _prompt = prompt; } + private: void run() { - while( !_run_complete.canceled() ) - { - try { + while( !_run_complete.canceled() ) + { + try { std::string line; try { - getline( ">>> ", line ); + getline( _prompt.c_str(), line ); } catch ( const fc::eof_exception& e ) { @@ -88,8 +90,9 @@ namespace fc { namespace rpc { { std::cout << e.to_detail_string() << "\n"; } - } + } } + std::string _prompt = ">>>"; std::map > _result_formatters; fc::future _run_complete; }; diff --git a/src/rpc/cli.cpp b/src/rpc/cli.cpp index fd441e4..1cc04ed 100644 --- a/src/rpc/cli.cpp +++ b/src/rpc/cli.cpp @@ -1,4 +1,3 @@ - #include #include @@ -31,10 +30,7 @@ namespace fc { namespace rpc { -void cli::getline( - const fc::string& prompt, - fc::string& line - ) +void cli::getline( const fc::string& prompt, fc::string& line) { // getting file descriptor for C++ streams is near impossible // so we just assume it's the same as the C stream...