U `g@sdddlmZmZmZddlZddlZddlZddlZddlm Z ddZ ddZ dd Z d d Z dS) )unicode_literalsprint_functionabsolute_importN)parsecCs|t|SN)findjsonload)exprfr sz!print_matches..)printjoin)matchesr r r print_matchessrc Gstjdtjdd}|jddd|jddd d d ||d d}t|j}|j}t|d krrt t |t j n<|D]6}t |D]&}t|}t t ||W5QRXqqvdS)Nz@Search JSON files (or stdin) according to a JSONPath expression.a$ Quick JSONPath reference (see more at https://github.com/kennknowles/python-jsonpath-rw) atomics: $ - root object `this` - current object operators: path1.path2 - same as xpath / path1|path2 - union path1..path2 - somewhere in between fields: fieldname - field with name * - any field [_start_?:_end_?] - array slice [*] - any array index ) descriptionformatter_classepilog expressionzA JSONPath expression.)helpfilesfile*z)Files to search (if none, searches stdin))metavarnargsrr)argparseArgumentParserRawTextHelpFormatter add_argument parse_argsrrrlenrrsysstdinglobopen)argvparserargsr Z glob_patternspatternfilenamer r r r mains    r3cCsttjdSr)r3r*r.r r r r entry_pointFsr4) __future__rrrrr*r,r$Z jsonpath_ngrrrr3r4r r r r  s +