Skip to content

Commit 0ff1611

Browse files
gh-130160: use .. program:: directive for documenting idle CLI (#130278)
--------- Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
1 parent cd6abe2 commit 0ff1611

File tree

1 file changed

+50
-18
lines changed

1 file changed

+50
-18
lines changed

Doc/library/idle.rst

+50-18
Original file line numberDiff line numberDiff line change
@@ -660,29 +660,61 @@ functions to be used from IDLE's Python shell.
660660
Command line usage
661661
^^^^^^^^^^^^^^^^^^
662662

663-
.. code-block:: none
663+
.. program:: idle
664664

665-
idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] [arg] ...
665+
IDLE can be invoked from the command line with various options. The general syntax is:
666666

667-
-c command run command in the shell window
668-
-d enable debugger and open shell window
669-
-e open editor window
670-
-h print help message with legal combinations and exit
671-
-i open shell window
672-
-r file run file in shell window
673-
-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window
674-
-t title set title of shell window
675-
- run stdin in shell (- must be last option before args)
667+
.. code-block:: bash
676668
677-
If there are arguments:
669+
python -m idlelib [options] [file ...]
678670
679-
* If ``-``, ``-c``, or ``r`` is used, all arguments are placed in
680-
``sys.argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``,
681-
or ``'-r'``. No editor window is opened, even if that is the default
682-
set in the Options dialog.
671+
The following options are available:
672+
673+
.. option:: -c <command>
674+
675+
Run the specified Python command in the shell window.
676+
For example, pass ``-c "print('Hello, World!')"``.
677+
On Windows, the outer quotes must be double quotes as shown.
678+
679+
.. option:: -d
680+
681+
Enable the debugger and open the shell window.
682+
683+
.. option:: -e
684+
685+
Open an editor window.
686+
687+
.. option:: -h
688+
689+
Print a help message with legal combinations of options and exit.
690+
691+
.. option:: -i
692+
693+
Open a shell window.
694+
695+
.. option:: -r <file>
696+
697+
Run the specified file in the shell window.
698+
699+
.. option:: -s
700+
701+
Run the startup file (as defined by the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`) before opening the shell window.
702+
703+
.. option:: -t <title>
704+
705+
Set the title of the shell window.
706+
707+
.. option:: -
708+
709+
Read and execute standard input in the shell window. This option must be the last one before any arguments.
710+
711+
If arguments are provided:
712+
713+
- If ``-``, ``-c``, or ``-r`` is used, all arguments are placed in ``sys.argv[1:]``,
714+
and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'`` respectively.
715+
No editor window is opened, even if that is the default set in the *Options* dialog.
716+
- Otherwise, arguments are treated as files to be opened for editing, and ``sys.argv`` reflects the arguments passed to IDLE itself.
683717

684-
* Otherwise, arguments are files opened for editing and
685-
``sys.argv`` reflects the arguments passed to IDLE itself.
686718

687719
Startup failure
688720
^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)