jenkins-bot submitted this change.
[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(-)
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 change 921708. To unsubscribe, or for help writing mail filters, visit settings.