Conditions | 5 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 4 | ||
Bugs | 2 | Features | 0 |
1 | #! /usr/bin/env python |
||
9 | def main(): |
||
10 | parser = argparse.ArgumentParser(prog='qiniu') |
||
11 | sub_parsers = parser.add_subparsers() |
||
12 | |||
13 | parser_etag = sub_parsers.add_parser( |
||
14 | 'etag', description='calculate the etag of the file', help='etag [file...]') |
||
15 | parser_etag.add_argument( |
||
16 | 'etag_files', metavar='N', nargs='+', help='the file list for calculate') |
||
17 | |||
18 | args = parser.parse_args() |
||
19 | |||
20 | try: |
||
21 | etag_files = args.etag_files |
||
22 | |||
23 | except AttributeError: |
||
24 | etag_files = None |
||
25 | |||
26 | if etag_files: |
||
27 | r = [etag(file) for file in etag_files] |
||
28 | if len(r) == 1: |
||
29 | print(r[0]) |
||
30 | else: |
||
31 | print(' '.join(r)) |
||
32 | |||
35 |