]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-130160: use `.. program::` directive for documenting `platform` CLI (GH...
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sat, 3 May 2025 12:37:09 +0000 (15:37 +0300)
committerGitHub <noreply@github.com>
Sat, 3 May 2025 12:37:09 +0000 (15:37 +0300)
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
Doc/library/cmdline.rst
Doc/library/platform.rst

index d10ff594ecb1f11027e7f034b21fb4effc62520c..32d23d9ae812821a065f34aff9796babd7bf50a9 100644 (file)
@@ -28,7 +28,7 @@ The following modules have a command-line interface.
 * :mod:`pdb`
 * :mod:`pickle`
 * :ref:`pickletools <pickletools-cli>`
-* :mod:`platform`
+* :ref:`platform <platform-cli>`
 * :mod:`poplib`
 * :ref:`profile <profile-cli>`
 * :mod:`pstats`
index 1beb3b9eb89d22a1d0e85813c2f40b83f5af86b4..7f2a902417b2411bfd996113c3d111297bed5b8c 100644 (file)
@@ -17,7 +17,7 @@
    section.
 
 
-Cross Platform
+Cross platform
 --------------
 
 
@@ -188,7 +188,7 @@ Cross Platform
       :attr:`processor` is resolved late instead of immediately.
 
 
-Java Platform
+Java platform
 -------------
 
 
@@ -206,7 +206,7 @@ Java Platform
       and was only useful for Jython support.
 
 
-Windows Platform
+Windows platform
 ----------------
 
 
@@ -240,7 +240,7 @@ Windows Platform
    .. versionadded:: 3.8
 
 
-macOS Platform
+macOS platform
 --------------
 
 .. function:: mac_ver(release='', versioninfo=('','',''), machine='')
@@ -252,7 +252,7 @@ macOS Platform
    Entries which cannot be determined are set to ``''``.  All tuple entries are
    strings.
 
-iOS Platform
+iOS platform
 ------------
 
 .. function:: ios_ver(system='', release='', model='', is_simulator=False)
@@ -271,7 +271,7 @@ iOS Platform
    parameters.
 
 
-Unix Platforms
+Unix platforms
 --------------
 
 .. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=16384)
@@ -287,7 +287,7 @@ Unix Platforms
    The file is read and scanned in chunks of *chunksize* bytes.
 
 
-Linux Platforms
+Linux platforms
 ---------------
 
 .. function:: freedesktop_os_release()
@@ -325,7 +325,7 @@ Linux Platforms
    .. versionadded:: 3.10
 
 
-Android Platform
+Android platform
 ----------------
 
 .. function:: android_ver(release="", api_level=0, manufacturer="", \
@@ -359,3 +359,32 @@ Android Platform
    <https://storage.googleapis.com/play_public/supported_devices.html>`__.
 
    .. versionadded:: 3.13
+
+.. _platform-cli:
+
+Command-line usage
+------------------
+
+:mod:`platform` can also be invoked directly using the :option:`-m`
+switch of the interpreter::
+
+   python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]
+
+The following options are accepted:
+
+.. program:: platform
+
+.. option:: --terse
+
+   Print terse information about the platform. This is equivalent to
+   calling :func:`platform.platform` with the *terse* argument set to ``True``.
+
+.. option:: --nonaliased
+
+   Print platform information without system/OS name aliasing. This is
+   equivalent to calling :func:`platform.platform` with the *aliased* argument
+   set to ``True``.
+
+You can also pass one or more positional arguments (``terse``, ``nonaliased``)
+to explicitly control the output format. These behave similarly to their
+corresponding options.