Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data = yaml.load(input)
try:
for item in op.apply([data]):
yield item
except MatchError as ex:
print ex
if __name__ == '__main__':
if len(sys.argv) < 2:
print >> sys.stderr, 'Usage: {} '.format(sys.argv[0])
sys.exit(2)
op = sys.argv[1]
input = sys.stdin.read()
for item in main(op, input):
print output(item)
#!/usr/bin/env python
import yaml
import sys
from yq import parser
from yq.operators.match_error import MatchError
from yq.output import output
op = parser.parse(sys.argv[1])
input = sys.stdin.read()
data = yaml.load(input)
try:
print output(op.apply(data))
except MatchError as ex:
print ex