add --version

This commit is contained in:
PyYoshi 2017-05-15 09:51:49 +09:00
parent a7d649871c
commit 94a4ce0ac7

View file

@ -18,6 +18,7 @@ def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('files', nargs='*', help="Files to detect encoding of", type=argparse.FileType('rb'), default=[sys.stdin if PY2 else sys.stdin.buffer]) parser.add_argument('files', nargs='*', help="Files to detect encoding of", type=argparse.FileType('rb'), default=[sys.stdin if PY2 else sys.stdin.buffer])
parser.add_argument('--chunk-size', type=int, default=(256 * 1024)) parser.add_argument('--chunk-size', type=int, default=(256 * 1024))
parser.add_argument('--version', action='version', version='%(prog)s {0}'.format(cchardet.__version__))
args = parser.parse_args() args = parser.parse_args()
for f in args.files: for f in args.files: