1) If there is an error evaluating a prompt function, prompt becomes undefined. Might want to set to a default prompt instead.
>
> prompt = '> '
>
> prompt = function()
function ()
{ return c; } Tue Sep 6 13:45:42 ReferenceError: c is not defined (shell):1 undefined Tue Sep 6 13:45:47 ReferenceError: c is not defined (shell):1 undefined Tue Sep 6 13:45:48 ReferenceError: c is not defined (shell):1 undefined 2) setting prompt to a regex has strange results > prompt = /a/ /a/ Tue Sep 6 15:22:44 SyntaxError: no input for /a/ :1 undefined 3) new lines in prompt mess up shell handling of current line and use of history. Other unusual characters (eg \b) and long lines seem to cause problems too. If the prompt line is wider than my terminal window, I never see anything other than the prompt and every time I type a character I get a new line with the prompt on it. Aaron-Staples-MacBook-Pro:mongo aaron$ ./mongo MongoDB shell version: 2.0.0-rc2-pre- connecting to: test > prompt = "you are special!\n> " you are special! > you are special! > db.c.count() 1 you are special! you are special!> you are special!> db.c.count() <<<----- pressing backspace repeatedly you are special!> db.c.count( you are special!> db.c.count you are special!> db.c.coun you are special!> db.c.cou you are special!> db.c.co you are special!> db.c.c > db.c. find() { "_id" : ObjectId("4e66a1acc98ce70998274933") }you are special!
you are special!>
you are special!> db.c.find() <<<----- pressing up arrow
you are special!> db.c.count()
you are special!> prompt = "you are special!\n> "
you are special!> db.c.count()
you are special!> prompt = "you are special!\n> "
you are special!> db.c.count()
you are special!> db.c.find()
you are special!>
you are special!> db.c.find()
you are special!> db.c.count()
you are special!> prompt = "you are special!\n> "
you are special!> db.c.count()
you are special!> db.c.find()
you are special!>
you are special!> db.c.find()
>
connecting to: test
> ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
4) Don't know if we want to allow them, but shell helpers aren't available in the prompt function:
> prompt = function()
{ use foo; return db.c.count(); }Tue Sep 6 15:47:12 SyntaxError: missing ; before statement (shell):1
> prompt = function()
{ exit; }function () {
exit;
}
Tue Sep 6 15:48:25 ReferenceError: exit is not defined (shell):1
undefined
- is related to
-
SERVER-3267 custom prompt
- Closed