summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authordannenberg <dannenberg.matt@gmail.com>2011-06-15 11:35:46 -0400
committerdannenberg <dannenberg.matt@gmail.com>2011-06-15 13:42:21 -0400
commit1c180c6a60126e8468e71d7b36b29ee0d7b7bdb9 (patch)
tree1f80762b7aef89ed26c8126719b5142651a402f7 /shell
parent951957f8646ba9b64473141adce9d2253afcc740 (diff)
downloadmongo-1c180c6a60126e8468e71d7b36b29ee0d7b7bdb9.tar.gz
SERVER-3267 very basic custom prompt added
Diffstat (limited to 'shell')
-rw-r--r--shell/dbshell.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp
index b5dac976c80..0014b34f7ac 100644
--- a/shell/dbshell.cpp
+++ b/shell/dbshell.cpp
@@ -669,6 +669,8 @@ int _main(int argc, char* argv[]) {
shellHistoryInit();
+ string prompt;
+
//v8::Handle<v8::Object> shellHelper = baseContext_->Global()->Get( v8::String::New( "shellHelper" ) )->ToObject();
while ( 1 ) {
@@ -677,8 +679,11 @@ int _main(int argc, char* argv[]) {
// shellMainScope->localConnect;
//DBClientWithCommands *c = getConnection( JSContext *cx, JSObject *obj );
- string prompt(sayReplSetMemberState()+"> ");
-
+ if (scope->exec("prompt", "", false, false, false)) {
+ prompt = scope->getString("prompt");
+ } else {
+ prompt = sayReplSetMemberState()+"> ";
+ }
char * line = shellReadline( prompt.c_str() );
if ( line ) {