[Python-checkins] cpython (merge 3.5 -> 3.6): Issue #28513: Documented command-line interface of zipfile.

serhiy.storchaka python-checkins at python.org
Wed Nov 2 06:14:15 EDT 2016


https://hg.python.org/cpython/rev/843538a4094b
changeset:   104873:843538a4094b
branch:      3.6
parent:      104869:4e9c7704f373
parent:      104872:b51bf32defb1
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Nov 02 12:11:32 2016 +0200
summary:
  Issue #28513: Documented command-line interface of zipfile.

files:
  Doc/library/zipfile.rst |  56 +++++++++++++++++++++++++++++
  Misc/NEWS               |   5 ++
  2 files changed, 61 insertions(+), 0 deletions(-)


diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -632,4 +632,60 @@
    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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -16,6 +16,11 @@
 Library
 -------
 
+Documentation
+-------------
+
+- Issue #28513: Documented command-line interface of zipfile.
+
 
 What's New in Python 3.6.0 beta 3
 =================================

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list