Mercurial > hg > cc > cirrus_home
comparison bin/ix.py @ 106:815b33c3254a
working with -x and rich directory structure
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Tue, 20 Apr 2021 12:26:09 +0000 |
parents | baf56ff538f8 |
children | 007f35b9df9c |
comparison
equal
deleted
inserted
replaced
105:baf56ff538f8 | 106:815b33c3254a |
---|---|
71 nargs='?') | 71 nargs='?') |
72 # Hack the order of optional and positional in the help output | 72 # Hack the order of optional and positional in the help output |
73 parser._action_groups.sort(key=lambda g:g.title) | 73 parser._action_groups.sort(key=lambda g:g.title) |
74 #parser.print_help() | 74 #parser.print_help() |
75 pa=parser.parse_args(sys.argv[1:]) | 75 pa=parser.parse_args(sys.argv[1:]) |
76 print(pa,file=sys.stderr) | 76 #print(pa,file=sys.stderr) |
77 if pa.length is not None: | 77 if pa.length is not None: |
78 # We have to enforce our own check.. | 78 # We have to enforce our own check.. |
79 if pa.offset is None or pa.filename is None: | 79 if pa.offset is None or pa.filename is None: |
80 parser.error("length, offset and filename must all be supplied together") | 80 parser.error("length, offset and filename must all be supplied together") |
81 | 81 |
91 m=CDX.search(l) | 91 m=CDX.search(l) |
92 if m is None: | 92 if m is None: |
93 print("index line problem: \"%s\""%l.lstrip(),file=sys.stderr) | 93 print("index line problem: \"%s\""%l.lstrip(),file=sys.stderr) |
94 exit(2) | 94 exit(2) |
95 f=FPAT%(m[3:6]) | 95 f=FPAT%(m[3:6]) |
96 process(pa,buf,open(f,'rb',0),int(m[2]),int(m[1]),whole) | 96 process(pa,buf,f,int(m[2]),int(m[1]),whole) |
97 exit(0) | 97 exit(0) |
98 if __name__ == "__main__": | 98 if __name__ == "__main__": |
99 main() | 99 main() |