summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-02 10:06:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-02 10:06:15 (GMT)
commit92c1a90462df5af2d5725f9b3faa5cc8f91dfbb6 (patch)
treef39c931800975d39f0ce5be7aea9f8b9da2b21ed
parent38adbfa71079f03747ac59f8eb848ab43fad753d (diff)
downloadcpython-92c1a90462df5af2d5725f9b3faa5cc8f91dfbb6.zip
cpython-92c1a90462df5af2d5725f9b3faa5cc8f91dfbb6.tar.gz
cpython-92c1a90462df5af2d5725f9b3faa5cc8f91dfbb6.tar.bz2
Issue #28513: Documented command-line interface of zipfile.
-rw-r--r--Doc/library/zipfile.rst57
-rw-r--r--Misc/NEWS5
2 files changed, 62 insertions, 0 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 1d6526c..bf482d2 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -574,4 +574,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 <zipfile>
+
+ List files in a zipfile.
+
+.. cmdoption:: -c <zipfile> <source1> ... <sourceN>
+
+ Create zipfile from source files.
+
+.. cmdoption:: -e <zipfile> <output_dir>
+
+ Extract zipfile into target directory.
+
+.. cmdoption:: -t <zipfile>
+
+ 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 76ac3a6..af4eb31 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -471,6 +471,11 @@ C API
- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as
an iterable of integers. Now only strings and bytes-like objects are accepted.
+Documentation
+-------------
+
+- Issue #28513: Documented command-line interface of zipfile.
+
Tests
-----