From f439ae4a236fd22acb828c130a78296c9d796f00 Mon Sep 17 00:00:00 2001 From: James Hiebert Date: Fri, 21 Jun 2019 12:11:55 -0700 Subject: [PATCH] Add the ability to pipe YAML to update_metadata In the Unix world, it's often useful to pipe input to a process on STDIN especially when one is scripting things. This change adds the ability for the update_metadata script to take input on STDIN if the "-u -" option is used. --- scripts/update_metadata | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/update_metadata b/scripts/update_metadata index 068f9e7..3a8fd6c 100644 --- a/scripts/update_metadata +++ b/scripts/update_metadata @@ -5,6 +5,7 @@ WARNING: THIS SCRIPT MODIFIES THE ORIGINAL FILE. See README for details of update specification file (YAML format). """ +import sys from argparse import ArgumentParser import logging @@ -27,5 +28,7 @@ if __name__ == '__main__': help='NetCDF file to update' ) args = parser.parse_args() + if args.updates == '-': + args.updates = sys.stdin logger.setLevel(getattr(logging, args.loglevel)) main(args)