2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: Apache-2.0
14 from arvados._version import __version__
16 parser = argparse.ArgumentParser(
17 description='Read manifest on standard input and put normalized manifest on standard output.')
19 parser.add_argument('--extract', type=str,
20 help="The file to extract from the input manifest")
21 parser.add_argument('--strip', action='store_true',
22 help="Strip authorization tokens")
23 parser.add_argument('--version', action='version',
24 version="%s %s" % (sys.argv[0], __version__),
25 help='Print version and exit.')
27 args = parser.parse_args()
31 cr = arvados.CollectionReader(r)
34 i = args.extract.rfind('/')
39 stream = args.extract[:i]
40 fn = args.extract[(i+1):]
41 for s in cr.all_streams():
42 if s.name() == stream:
44 sys.stdout.write(s.files()[fn].as_manifest())
46 sys.stdout.write(cr.manifest_text(strip=args.strip, normalize=True))