-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrec-comp
executable file
·33 lines (26 loc) · 1.63 KB
/
rec-comp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from tinyscript import *
from reccomp import Compressor
from reccomp.__info__ import *
__examples__ = ["file1 file2 file3 -r 10", "file -c abcd -n 10", "file -p"]
__doc__ = """
This tool allows to recursively compress an archive relying on Patool, a Python
library supporting various archive formats.
Note: Password-protected compression is not supported.
"""
if __name__ == '__main__':
alphanum = string.ascii_letters+string.digits
parser.add_argument("files", nargs="+", type=ts.file_exists, help="files to be archived")
parser.add_argument("-c", dest="charset", default=alphanum, help="character set of random archive name")
parser.add_argument("-d", dest="delete", action="store_true", help="delete input files")
parser.add_argument("-f", dest="formats", default="all", help="compression algorithms")
parser.add_argument("-n", dest="nchars", type=ts.pos_int, default=8, help="length of random archive name")
parser.add_argument("-r", "--rounds", type=ts.pos_int, default=10, help="number of compression rounds")
parser.add_argument("--no-error", dest="fix", action="store_true", help="recompress if errors are found")
parser.add_argument("--reverse", action="store_true", help="reverse byte order")
data = parser.add_argument_group("data options")
data.add_argument("--data", help="data to be embedded")
data.add_argument("--chunks", type=ts.pos_int, default=10, help="number of chunks the data should be split in")
initialize(add_progress=True, add_time=True)
Compressor(logger=logger, pbar=progressbar, **vars(args))