
    %h                     N    S r SSKrSSKrSSKJr  SSKrSSKJr  S rS r	SS jr
g)	ae  Module that contains the command line app.

Why does this file exist, and why not put this in __main__?
  You might be tempted to import things from __main__ later, but that will
  cause problems: the code will get executed twice:
  - When you run `python -m sqlparse` python will execute
    ``__main__.py`` as a script. That means there won't be any
    ``sqlparse.__main__`` in ``sys.modules``.
  - When you import __main__ it will get executed again (as a module) because
    there's no ``sqlparse.__main__`` in ``sys.modules``.
  Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration
    N)TextIOWrapper)SQLParseErrorc                     / SQn [         R                  " SSSS9nUR                  S5        UR                  SSS	S
SS9  UR                  SS[        R                  S9  UR                  S5      nUR                  SSSSU SR                  SR                  S U  5       5      5      S9  UR                  SSSSU SR                  SR                  S U  5       5      5      S9  UR                  SSS S!S"S#/S$S9  UR                  S%S&S'S(S)S*9  UR                  S+S,S-S'S(S.S*9  UR                  S/S0S1[        S2S39  UR                  S4S5S'S(S6S*9  UR                  S7S8S'S(S9S*9  UR                  S:S;S'S(S<S=9  UR                  S>S?S'S(S@S=9  UR                  SASBSC[        SDS39  UR                  SESFS([        SGS39  UR                  SHSIS([        SJS39  UR                  SKSLSMSNSO9  U$ )PN)upperlower
capitalize	sqlformatzEFormat FILE according to OPTIONS. Use "-" as FILE to read from stdin.z%(prog)s  [OPTIONS] FILE, ...)progdescriptionusagefilenamez-oz	--outfileoutfileFILEz)write output to FILE (defaults to stdout))destmetavarhelpz	--versionversion)actionr   zFormatting Optionsz-kz
--keywordsCHOICEkeyword_casez,change case of keywords, CHOICE is one of {}z, c              3   D   #    U  H  nS R                  U5      v   M     g7fz"{}"Nformat.0xs     >/var/www/html/env/lib/python3.13/site-packages/sqlparse/cli.py	<genexpr> create_parser.<locals>.<genexpr>?        >1fmmA&&    )r   r   choicesr   z-iz--identifiersidentifier_casez/change case of identifiers, CHOICE is one of {}c              3   D   #    U  H  nS R                  U5      v   M     g7fr   r   r   s     r   r   r    G   r!   r"   z-lz
--languageLANGoutput_formatpythonphpzJoutput a snippet in programming language LANG, choices are "python", "php"z--strip-commentsstrip_comments
store_trueFzremove comments)r   r   defaultr   z-rz
--reindentreindentzreindent statementsz--indent_widthindent_width   z(indentation width (defaults to 2 spaces))r   r,   typer   z--indent_after_firstindent_after_firstz2indent after first line of statement (e.g. SELECT)z--indent_columnsindent_columnsz<indent all columns by indent_width instead of keyword lengthz-az--reindent_alignedz%reindent statements to aligned format)r   r,   r   z-sz--use_space_around_operatorsz*place spaces around mathematical operatorsz--wrap_after
wrap_afterr   z*Column after which lists should be wrappedz--comma_firstcomma_firstz-Insert linebreak before comma (default False)z	--compactcompactz2Try to produce more compact output (default False)z
--encodingencodingzutf-8z*Specify the input encoding (default utf-8))r   r,   r   )
argparseArgumentParseradd_argumentsqlparse__version__add_argument_groupr   joinintbool)_CASE_CHOICESparsergroups      r   create_parserrC       s   4M$$*-	F 
#
k8	  : $$  &
 %%&:;E	l;BBII>>>@  A 
o>EEII>>>@  A 
l5!+  , 
    
l"  $ 
7  9 
!A  C 
K  M 
"4	  6 
,9	  ; 
9  ; 
<  > 
A  C 
9	  ; M    c                 `    [         R                  R                  SR                  U 5      5        g)z5Print msg and optionally exit with return code exit_.z[ERROR] {}
   )sysstderrwriter   )msgs    r   _errorrK      s"    JJ^**3/0rD   c                    [        5       nUR                  U 5      n U R                  S:X  aN  [        [        R
                  R                  U R                  S9n UR                  5       nUR                  5         OG [        U R                  U R                  S9 nSR                  UR                  5       5      nS S S 5        SnU R                   (       a#   [        U R                   SU R                  S9nSnO[        R"                  n[%        U 5      n [&        R(                  R+                  U5      n[&        R                  " W40 UD6n	UR/                  U	5        UR1                  5         U(       a  UR3                  5         g
! UR                  5         f = f! , (       d  f       N= f! [         a/  n[        SR                  U R                  U5      5      s S nA$ S nAff = f! [         a/  n[        SR                  U R                   U5      5      s S nA$ S nAff = f! [,         a$  n[        S	R                  U5      5      s S nA$ S nAff = f)N-)r6    zFailed to read {}: {}FwTzFailed to open {}: {}zInvalid options: {}r   )rC   
parse_argsr   r   rG   stdinbufferr6   readdetachopenr=   	readlinesOSErrorrK   r   r   stdoutvarsr:   	formattervalidate_optionsr   rI   flushclose)
argsrA   wrapperdatafeclose_streamstreamformatter_optsss
             r   mainrg      s   _FT"D}}		 0 04==I	<<>DNN	Bdmmdmm<wwq{{}- = L||	K$,,dmmDFL $ZN7!++<<^L 	//A
LLO
LLN= NN =< 	B'..t}}a@B B	B  	K188qIJJ	K  7+2215667s   F ;F(  F9F( !G$ H  F
F%!F( %F( (
G!2$GG!G!$
H.$HHH 
I*I	I	I)N)__doc__r7   rG   ior   r:   sqlparse.exceptionsr   rC   rK   rg    rD   r   <module>rl      s,     
   -
{|'rD   