From: Serhiy Storchaka Date: Wed, 2 Nov 2016 10:05:54 +0000 (+0200) Subject: Issue #28513: Documented command-line interface of zipfile. X-Git-Tag: v2.7.13rc1~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b858d7f07461ef342fcb0731e9d1353f7b64b7d2;p=python Issue #28513: Documented command-line interface of zipfile. --- diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 3322552e58..ba613b3f8e 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -497,4 +497,61 @@ Instances have the following attributes: Size of the uncompressed file. + +.. _zipfile-commandline: +.. program:: zipfile + +Command-Line Interface +---------------------- + +The :mod:`zipfile` module provides a simple command-line interface to interact +with ZIP archives. + +If you want to create a new ZIP archive, specify its name after the :option:`-c` +option and then list the filename(s) that should be included: + +.. code-block:: shell-session + + $ python -m zipfile -c monty.zip spam.txt eggs.txt + +Passing a directory is also acceptable: + +.. code-block:: shell-session + + $ python -m zipfile -c monty.zip life-of-brian_1979/ + +If you want to extract a ZIP archive into the specified directory, use +the :option:`-e` option: + +.. code-block:: shell-session + + $ python -m zipfile -e monty.zip target-dir/ + +For a list of the files in a ZIP archive, use the :option:`-l` option: + +.. code-block:: shell-session + + $ python -m zipfile -l monty.zip + + +Command-line options +~~~~~~~~~~~~~~~~~~~~ + +.. cmdoption:: -l + + List files in a zipfile. + +.. cmdoption:: -c ... + + Create zipfile from source files. + +.. cmdoption:: -e + + Extract zipfile into target directory. + +.. cmdoption:: -t + + Test whether the zipfile is valid or not. + + .. _PKZIP Application Note: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT diff --git a/Misc/NEWS b/Misc/NEWS index 984aac67f2..a296d6a676 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -236,6 +236,8 @@ IDLE Documentation ------------- +- Issue #28513: Documented command-line interface of zipfile. + - Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik Nadikuditi.