Skip to content

Commit 1550c30

Browse files
authored
gh-130160: use .. program:: directive for documenting platform CLI (#133335)
1 parent 77c391a commit 1550c30

File tree

2 files changed

+37
-9
lines changed

2 files changed

+37
-9
lines changed

Doc/library/cmdline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The following modules have a command-line interface.
2727
* :mod:`pdb`
2828
* :ref:`pickle <pickle-cli>`
2929
* :ref:`pickletools <pickletools-cli>`
30-
* :mod:`platform`
30+
* :ref:`platform <platform-cli>`
3131
* :mod:`poplib`
3232
* :ref:`profile <profile-cli>`
3333
* :mod:`pstats`

Doc/library/platform.rst

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
section.
1818

1919

20-
Cross Platform
20+
Cross platform
2121
--------------
2222

2323

@@ -188,7 +188,7 @@ Cross Platform
188188
:attr:`processor` is resolved late instead of immediately.
189189

190190

191-
Java Platform
191+
Java platform
192192
-------------
193193

194194

@@ -206,7 +206,7 @@ Java Platform
206206
and was only useful for Jython support.
207207

208208

209-
Windows Platform
209+
Windows platform
210210
----------------
211211

212212

@@ -240,7 +240,7 @@ Windows Platform
240240
.. versionadded:: 3.8
241241

242242

243-
macOS Platform
243+
macOS platform
244244
--------------
245245

246246
.. function:: mac_ver(release='', versioninfo=('','',''), machine='')
@@ -252,7 +252,7 @@ macOS Platform
252252
Entries which cannot be determined are set to ``''``. All tuple entries are
253253
strings.
254254

255-
iOS Platform
255+
iOS platform
256256
------------
257257

258258
.. function:: ios_ver(system='', release='', model='', is_simulator=False)
@@ -271,7 +271,7 @@ iOS Platform
271271
parameters.
272272

273273

274-
Unix Platforms
274+
Unix platforms
275275
--------------
276276

277277
.. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=16384)
@@ -287,7 +287,7 @@ Unix Platforms
287287
The file is read and scanned in chunks of *chunksize* bytes.
288288

289289

290-
Linux Platforms
290+
Linux platforms
291291
---------------
292292

293293
.. function:: freedesktop_os_release()
@@ -325,7 +325,7 @@ Linux Platforms
325325
.. versionadded:: 3.10
326326

327327

328-
Android Platform
328+
Android platform
329329
----------------
330330

331331
.. function:: android_ver(release="", api_level=0, manufacturer="", \
@@ -360,6 +360,34 @@ Android Platform
360360

361361
.. versionadded:: 3.13
362362

363+
.. _platform-cli:
364+
365+
Command-line usage
366+
------------------
367+
368+
:mod:`platform` can also be invoked directly using the :option:`-m`
369+
switch of the interpreter::
370+
371+
python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]
372+
373+
The following options are accepted:
374+
375+
.. program:: platform
376+
377+
.. option:: --terse
378+
379+
Print terse information about the platform. This is equivalent to
380+
calling :func:`platform.platform` with the *terse* argument set to ``True``.
381+
382+
.. option:: --nonaliased
383+
384+
Print platform information without system/OS name aliasing. This is
385+
equivalent to calling :func:`platform.platform` with the *aliased* argument
386+
set to ``True``.
387+
388+
You can also pass one or more positional arguments (``terse``, ``nonaliased``)
389+
to explicitly control the output format. These behave similarly to their
390+
corresponding options.
363391

364392
Miscellaneous
365393
-------------

0 commit comments

Comments
 (0)