[SERVER-5399] Add "quit" as a synonym for "exit" in mongo command shell Created: 25/Mar/12  Updated: 18/Sep/15  Resolved: 16/Jan/15

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.0.4
Fix Version/s: 3.0.0-rc6

Type: Improvement Priority: Trivial - P5
Reporter: Robert La Ferla Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: neweng, polish, pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Issue Links:
Related
related to SERVER-17167 Shell breaks when a multiline functio... Closed
related to SERVER-5764 Multi-line mode in the shell went away Closed
related to SERVER-16946 "it" not working in the javascript sh... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   
Issue Status as of Feb 04, 2015

NOTE
The changes in this ticket were reverted as part of SERVER-17167

Add "quit" as a synonym for "exit" in mongo command shell

> exit
bye

should also work with quit:

> quit
bye



 Comments   
Comment by Githook User [ 04/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 Essentially aliasing quit, exit, and function call variations."

This reverts commit f1d696d46b65dd1f76727b37d85e0c08c291f533.

(cherry picked from commit fc14926f9c8256edce8bbd15d439ca34667c6ebb)
Branch: v3.0
https://github.com/mongodb/mongo/commit/3f09e9dacbb34f9cdd45ac025ba0c8238eec5d31

Comment by Githook User [ 04/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 SERVER-16946 fixed shell helper parsing"

This reverts commit 2d397b55c3207e875b6085944799b3c243ff4cf3.

(cherry picked from commit f67e39825ac93c0915db0192d7a35b3d73834388)
Branch: v3.0
https://github.com/mongodb/mongo/commit/f0531d8229e9a3e2d663ba0612495ad2ba4aa1b7

Comment by Githook User [ 03/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 Essentially aliasing quit, exit, and function call variations."

This reverts commit f1d696d46b65dd1f76727b37d85e0c08c291f533.
Branch: master
https://github.com/mongodb/mongo/commit/fc14926f9c8256edce8bbd15d439ca34667c6ebb

Comment by Githook User [ 03/Feb/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-17167 restore multiline functionality in shell

Revert "SERVER-5399 SERVER-16946 fixed shell helper parsing"

This reverts commit 2d397b55c3207e875b6085944799b3c243ff4cf3.
Branch: master
https://github.com/mongodb/mongo/commit/f67e39825ac93c0915db0192d7a35b3d73834388

Comment by Githook User [ 20/Jan/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-5399 SERVER-16946 fixed shell helper parsing
Branch: master
https://github.com/mongodb/mongo/commit/2d397b55c3207e875b6085944799b3c243ff4cf3

Comment by Githook User [ 16/Jan/15 ]

Author:

{u'username': u'amcfague', u'name': u'Andrew McFague', u'email': u'redmumba@gmail.com'}

Message: SERVER-5399 Essentially aliasing quit, exit, and function call variations.

Previously, `exit` was being implemented as a code in the DB shell,
while `quit` was being implemented as a shell function. This meant that
both were doing different things, and were called differently--i.e.,
`exit` could be run as is, whereas `quit()` had to be called as a
function.
Additional cleanups / improvements:
Clarifying Control-C/D handling code.
Moving string operations to use boost::algorithm::string libs
Clarifying logic in command parsing
Renaming variable for user input to something more relevant ("code" -> "line").

This re-applies commit b118ba77c541b5f952cc9c3e418fee0644ee4c7f (rolled back
in commit 1f3ac382c4892f03a0d2c5da076fa5271867fbbc) with a fix for multi-line.

Closes #221

Signed-off-by: Benety Goh <benety@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/f1d696d46b65dd1f76727b37d85e0c08c291f533

Comment by Tad Marshall [ 04/May/12 ]

The call to "finishCode() was completely removed in your edit. This code checks to see if there is an open parenthesis, brace or bracket and collects additional lines of text until the expression is balanced. Also, a ctrl-C while in multi-line mode is supposed to drop you out of multi-line mode but not exit the shell.

Comment by Andrew McFague [ 04/May/12 ]

I will look into why/how this broke multi-line editing and hopefully submit an updated patch!

Comment by auto [ 04/May/12 ]

Author:

{u'login': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: Rollback b118ba77c541b5f952cc9c3e418fee0644ee4c7f, which broke multi-line.

Effectively reopens SERVER-5399.
Branch: master
https://github.com/mongodb/mongo/commit/1f3ac382c4892f03a0d2c5da076fa5271867fbbc

Comment by Andy Schwerin [ 04/May/12 ]

The submitted fix broke multi-line functionality, and has been rolled back pending a fix that preserves it.

Comment by Andy Schwerin [ 04/May/12 ]

Documentation for how to use the shell should be updated to reflect that the following commands/statements in the shell are all synonyms:

quit
exit
quit()
exit()

Comment by auto [ 04/May/12 ]

Author:

{u'login': u'amcfague', u'name': u'Andrew McFague', u'email': u'redmumba@gmail.com'}

Message: SERVER-5399: Essentially aliasing quit, exit, and function call variations.

Signed-off-by: Andy Schwerin <schwerin@10gen.com>

Previously, `exit` was being implemented as a code in the DB shell,
while `quit` was being implemented as a shell function. This meant that
both were doing different things, and were called differently--i.e.,
`exit` could be run as is, whereas `quit()` had to be called as a
function.

Additional cleanups / improvements:

Clarifying Control-C/D handling code.
Moving string operations to use boost::algorithm::string libs
Clarifying logic in command parsing
Renaming variable for user input to something more relevant ("code" -> "line").
Branch: master
https://github.com/mongodb/mongo/commit/b118ba77c541b5f952cc9c3e418fee0644ee4c7f

Comment by Andrew McFague [ 27/Apr/12 ]

Made a pull request here; feel free to review.

https://github.com/mongodb/mongo/pull/216

This will allow you to use both `quit`, `exit`, `quit()`, `exit()`, `quit(#)`, and `exit(#)` from the shell.

Andrew

Comment by Andrew McFague [ 27/Apr/12 ]

An interesting tidbit here is, they're not actually the same internally. Whereas the `exit` gets processed as part of the commands, `quit` is actually a shell function. This raises questions, especially since `quit` binds to `mongo/shell/shell_utils.cpp:Quit`, then calls `goingAwaySoon()`, which locks a mutex that the `exit` command does not touch.

I am taking a deeper look into this, as well as cleaning up the prompt handling code.

Comment by Eliot Horowitz (Inactive) [ 26/Mar/12 ]

works:
exit
quit()

doesn't work
exit()
quit

should all be the same

Generated at Thu Feb 08 03:08:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.