https://github.com/python/cpython/commit/766170405e7eb1968d6fc643a5c5c187a5979152 commit: 766170405e7eb1968d6fc643a5c5c187a5979152 branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: terryjreedy <tjre...@udel.edu> date: 2025-02-23T22:58:28-05:00 summary:
[3.13] gh-130160: use `.. program::` directive for documenting `idle` CLI (GH-130278) (#130494) gh-130160: use `.. program::` directive for documenting `idle` CLI (GH-130278) --------- (cherry picked from commit 0ff16115741aeaaaf7f963f68d5c575efb960277) Co-authored-by: Kanishk Pachauri <itskanishkp...@gmail.com> files: M Doc/library/idle.rst diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 0aed6f0770dcd0..fabea611e0ebcd 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -660,29 +660,61 @@ functions to be used from IDLE's Python shell. Command line usage ^^^^^^^^^^^^^^^^^^ -.. code-block:: none +.. program:: idle - idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] [arg] ... +IDLE can be invoked from the command line with various options. The general syntax is: - -c command run command in the shell window - -d enable debugger and open shell window - -e open editor window - -h print help message with legal combinations and exit - -i open shell window - -r file run file in shell window - -s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window - -t title set title of shell window - - run stdin in shell (- must be last option before args) +.. code-block:: bash -If there are arguments: + python -m idlelib [options] [file ...] -* If ``-``, ``-c``, or ``r`` is used, all arguments are placed in - ``sys.argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``, - or ``'-r'``. No editor window is opened, even if that is the default - set in the Options dialog. +The following options are available: + +.. option:: -c <command> + + Run the specified Python command in the shell window. + For example, pass ``-c "print('Hello, World!')"``. + On Windows, the outer quotes must be double quotes as shown. + +.. option:: -d + + Enable the debugger and open the shell window. + +.. option:: -e + + Open an editor window. + +.. option:: -h + + Print a help message with legal combinations of options and exit. + +.. option:: -i + + Open a shell window. + +.. option:: -r <file> + + Run the specified file in the shell window. + +.. option:: -s + + Run the startup file (as defined by the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`) before opening the shell window. + +.. option:: -t <title> + + Set the title of the shell window. + +.. option:: - + + Read and execute standard input in the shell window. This option must be the last one before any arguments. + +If arguments are provided: + +- If ``-``, ``-c``, or ``-r`` is used, all arguments are placed in ``sys.argv[1:]``, + and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'`` respectively. + No editor window is opened, even if that is the default set in the *Options* dialog. +- Otherwise, arguments are treated as files to be opened for editing, and ``sys.argv`` reflects the arguments passed to IDLE itself. -* Otherwise, arguments are files opened for editing and - ``sys.argv`` reflects the arguments passed to IDLE itself. Startup failure ^^^^^^^^^^^^^^^ _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com