jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/921708 )
Change subject: [IMPR] improve documentation
......................................................................
[IMPR] improve documentation
- add documentation about how to leave shell
- add exitmsg parameter to code.interact which is available since
Python 3.6
Change-Id: Ie1176e22495d330bb3fb0db96a309d8e4a5fe12e
---
M pywikibot/scripts/shell.py
1 file changed, 25 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/scripts/shell.py b/pywikibot/scripts/shell.py
index 1b53993..bdfe181 100755
--- a/pywikibot/scripts/shell.py
+++ b/pywikibot/scripts/shell.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
-"""
-Spawns an interactive Python shell and imports the pywikibot library.
+"""Spawns an interactive Python shell and imports the pywikibot library.
+
+To exit the shell, type :kbd:`ctrl-D` (Linux) or :kbd:`ctrl-Z` (Windows)
+or use the :func:`exit` function.
The following local option is supported::
@@ -14,7 +16,7 @@
.. versionchanged:: 7.0
moved to pywikibot.scripts
"""
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2023
#
# Distributed under the terms of the MIT license.
#
@@ -23,7 +25,11 @@
def main(*args: str) -> None:
- """Script entry point."""
+ """Script entry point.
+
+ .. versionchanged:: 8.2
+ *exitmsg* was added for :func:`code.interact`.
+ """
args = list(args)
if '-noimport' in args:
args.remove('-noimport')
@@ -45,7 +51,8 @@
if hasattr(sys, '__interactivehook__'):
sys.__interactivehook__()
- code.interact("""Welcome to the Pywikibot interactive
shell!""", local=env)
+ code.interact('Welcome to the Pywikibot interactive shell!', local=env,
+ exitmsg='Thank you for using Pywikibot; exiting now...\n')
if __name__ == '__main__': # pragma: no cover
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/921708
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie1176e22495d330bb3fb0db96a309d8e4a5fe12e
Gerrit-Change-Number: 921708
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged