#!/usr/bin/env python
#
# This file is a replacement for the 'unzip' command.
#
# We obtain its main feature (extraction) through the 'zipfile' python module.

import argparse

parser = argparse.ArgumentParser(description='Extract the contents of a .zip archive')
parser.add_argument('filename', help="the .zip archive", type=argparse.FileType('r'))
parser.add_argument('-d',help='An optional directory to which to extract files. Set to "." by default.',action='store',default='.')

args = parser.parse_args()
from zipfile import ZipFile
ZipFile(args.filename).extractall(args.d)
