diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-05-19 11:54:30 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-05-19 11:54:30 -0400 |
commit | 3a75b466c8fc5bd6719f842a2952cceb413b0197 (patch) | |
tree | 298749bba2e965ea7b2d8feae13d611886ec3654 | |
parent | c1df2f1a5f6acccab9ef952bdd2fec12ba471d9b (diff) | |
download | mongo-3a75b466c8fc5bd6719f842a2952cceb413b0197.tar.gz |
fix shell commands
-rw-r--r-- | shell/utils.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/shell/utils.js b/shell/utils.js index ba926231e99..5788092f232 100644 --- a/shell/utils.js +++ b/shell/utils.js @@ -259,7 +259,18 @@ shellPrintHelper = function( x ){ } execShellLine = function(){ - var res = eval( __line__ ); + var l = __line__.trim(); + + var cmd = l.substring( 0 , ( l.indexOf( " " ) || l.length ) ); + if ( cmd.length == 0 ) + cmd = l; + + if ( shellHelper[ cmd ] ){ + shellHelper( cmd , l.substring( cmd.length + 1 ).trim() ); + return; + } + + var res = eval( l ); if ( typeof( res ) != "undefined" ){ shellPrintHelper( res ); } |