
    )g                         d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ d
dZ	e
d	k(  r ej                   e	              yy)zA tool to parse and pretty-print JSON5.

Usage:

    $ echo '{foo:"bar"}' | python -m json5.tool
    {
        foo: 'bar',
    }
    $ echo '{foo:"bar"}' | python -m json5.tool --as-json
    {
        "foo": "bar"
    }
    N   )
arg_parser)lib)Host)__version__c                 p   |xs
 t               }t        j                  |dt              }|j	                  dddd       |j	                  dd	d
ddd       |j	                  dddd       |j	                  dddd       |j	                  dddd       |j	                  dddd       |j	                  dd dd!"       |j	                  d#d$d%d&d'(       |j                  |       }|j                  |j                  S |j                  r|j                  t               y)|j                  r|j                  }nE|j                  d&k(  r|j                  j                         }n|j                  |j                        }|j                  d*k(  rd |_        n	 t!        |j                        |_        |j$                  rd|_        d|_        t+        j,                  |      }t+        j.                  ||j                  |j&                  |j(                  +      }|j                  |       y)# t"        $ r Y w xY w),Njson5)progdescz-cSTRcmdz:inline json5 string to read instead of reading from a file)metavardesthelpz	--as-jsonas_jsonstore_constTFz:output as JSON (same as --quote-keys --no-trailing-commas))r   actionconstdefaultr   z--indentindent   z0amount to indent each line (default is 4 spaces))r   r   r   z--quote-keys
store_truezquote all object keys)r   r   r   z--no-quote-keysstore_false
quote_keyszBdon't quote object keys that are identifiers (this is the default))r   r   r   z--trailing-commaszUadd commas after the last item in multi-line objects and arrays (this is the default)z--no-trailing-commastrailing_commaszEdo not add commas after the last item in multi-line lists and objects)r   r   r   fileFILE?-z`optional file to read JSON5 document from; if not specified or "-", will read from stdin instead)r   nargsr   r   r   None)r   r   r   )r   r   ArgumentParser__doc__add_argument
parse_argsexit_statusversionprint_r   r   r   stdinreadread_text_filer   int
ValueErrorr   r   r   r   loadsdumps)argvhostparserargsinpobjss          *lib/python3.12/site-packages/json5/tool.pymainr8   %   sQ   >46D&&t'HF
L	   L   B	   $	   !	   3	   '	      T"D%!!!||K xxhh	c	jjoo!!$)),{{f	dkk*DK ||$
))C.C		{{??,,		A 	KKN  		s   H) )	H54H5__main__)NN)r#   sys r   r   r1   r   r'   r   r8   __name__exit     r7   <module>r@      sA         `F zCHHTV r?   