#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__ = "Alexandre D'Hondt"
__version__ = "2.1"
__copyright__ = "A. D'Hondt"
__license__   = "agpl-3.0"
__training__ = "ZSIS CTF - Trivia - Shining (4 points)"
__examples__ = ["archive.zip", "archive.zip -d"]


from tinyscript import *

from reccomp import Decompressor


__doc__ = """
This tool allows to recursively decompress an archive relying on Patool, a
 Python library supporting various archive formats.

Note: Password-protected compression is not supported yet. If the tool freezes
       while decompressing, it may be necessary to press enter to submit a blank
       password, which will stop decompression.
"""


if __name__ == '__main__':
    parser.add_argument("archive", help="input archive")
    parser.add_argument("-d", dest="delete", action="store_true",
                        help="delete input archive")
    parser.add_argument("-p", dest="printf", action="store_true",
                        help="print resulting file, if possible")
    initialize(globals(), add_time=True)
    Decompressor(args.archive, args.printf, args.delete, logger=logger)
