From 096c0545efff29cc7acbfacee1447a7fc9b47c73 Mon Sep 17 00:00:00 2001 From: donBarbos <donbarbos@proton.me> Date: Sun, 9 Mar 2025 10:57:59 +0400 Subject: [PATCH 1/2] gh-130160: use `.. program::` directive for documenting `webbrowser` CLI (#130995) use `.. program::` directive for documenting `webbrowser` CLI (cherry picked from commit 92e5f826ace1eab29920a0a3487a3cac7eeab925) --- Doc/library/webbrowser.rst | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst index c34b2170f8f1e3..379e6fa497ece6 100644 --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -33,11 +33,30 @@ allow the remote browser to maintain its own windows on the display. If remote browsers are not available on Unix, the controlling process will launch a new browser and wait. +On iOS, the :envvar:`BROWSER` environment variable, as well as any arguments +controlling autoraise, browser preference, and new tab/window creation will be +ignored. Web pages will *always* be opened in the user's preferred browser, in +a new tab, with the browser being brought to the foreground. The use of the +:mod:`webbrowser` module on iOS requires the :mod:`ctypes` module. If +:mod:`ctypes` isn't available, calls to :func:`.open` will fail. + +.. program:: webbrowser + The script :program:`webbrowser` can be used as a command-line interface for the module. It accepts a URL as the argument. It accepts the following optional -parameters: ``-n`` opens the URL in a new browser window, if possible; -``-t`` opens the URL in a new browser page ("tab"). The options are, -naturally, mutually exclusive. Usage example:: +parameters: + +.. option:: -n, --new-window + + Opens the URL in a new browser window, if possible. + +.. option:: -t, --new-tab + + Opens the URL in a new browser tab. + +The options are, naturally, mutually exclusive. Usage example: + +.. code-block:: bash python -m webbrowser -t "https://www.python.org" From adced4b9af79c84a96e62e3d27ba2dc8231f06b9 Mon Sep 17 00:00:00 2001 From: donBarbos <donbarbos@proton.me> Date: Sun, 9 Mar 2025 11:26:23 +0400 Subject: [PATCH 2/2] remove extra paragraph --- Doc/library/webbrowser.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst index 379e6fa497ece6..9c3ff5efa2ebd2 100644 --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -33,13 +33,6 @@ allow the remote browser to maintain its own windows on the display. If remote browsers are not available on Unix, the controlling process will launch a new browser and wait. -On iOS, the :envvar:`BROWSER` environment variable, as well as any arguments -controlling autoraise, browser preference, and new tab/window creation will be -ignored. Web pages will *always* be opened in the user's preferred browser, in -a new tab, with the browser being brought to the foreground. The use of the -:mod:`webbrowser` module on iOS requires the :mod:`ctypes` module. If -:mod:`ctypes` isn't available, calls to :func:`.open` will fail. - .. program:: webbrowser The script :program:`webbrowser` can be used as a command-line interface for the