
    Dvg                     N    d Z ddlZddlZddlmZ ddlZddlmZ d Zd Z	ddZ
dS )	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                     g d} t          j        ddd          }|                    d           |                    ddd	d
d           |                    ddt          j                   |                    d          }|                    dddd| d                    d                    d | D                                            |                    dddd| d                    d                    d | D                                            |                    ddd d!d"d#gd$           |                    d%d&d'd(d)*           |                    d+d,d-d'd(d.*           |                    d/d0d1t          d23           |                    d4d5d'd(d6*           |                    d7d8d'd(d9*           |                    d:d;d'd(d<=           |                    d>d?d'd(d@=           |                    dAdBdCt          dD3           |                    dEdFd(t          dG3           |                    dHdId(t          dJ3           |                    dKdLdMdNO           |S )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   @   K   | ]}d                      |          V  dS z"{}"Nformat.0xs     I/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/sqlparse/cli.py	<genexpr>z create_parser.<locals>.<genexpr>?   .      >>1fmmA&&>>>>>>    )r   r   choicesr   z-iz--identifiersidentifier_casez/change case of identifiers, CHOICE is one of {}c              3   @   K   | ]}d                      |          V  dS r   r   r   s     r   r   z create_parser.<locals>.<genexpr>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_parserrB       s   444M$*-	  F 
###
k8	  : : : $  & & &
 %%&:;;E	l;BBII>>>>>>>@ @  A A A 
o>EEII>>>>>>>@ @  A A A 
l5!+  , , , 
        
l"  $ $ $ 
7  9 9 9 
!A  C C C 
K  M M M 
"4	  6 6 6 
,9	  ; ; ; 
9  ; ; ; 
<  > > > 
A  C C C 
9	  ; ; ; Mr!   c                 j    t           j                            d                    |                      dS )z5Print msg and optionally exit with return code exit_.z[ERROR] {}
   )sysstderrwriter   )msgs    r   _errorrI      s+    J^**3//0001r!   c                    t                      }|                    |           } | j        dk    rht          t          j        j        | j                  }	 |                                }|	                                 n# |	                                 w xY w	 t          | j        | j                  5 }d                    |                                          }d d d            n# 1 swxY w Y   n?# t          $ r2}t          d                    | j        |                    cY d }~S d }~ww xY wd}| j        r_	 t          | j        d| j                  }d}nK# t          $ r2}t          d                    | j        |                    cY d }~S d }~ww xY wt          j        }t%          |           }	 t&          j                            |          }n9# t,          $ r,}t          d	                    |                    cY d }~S d }~ww xY wt'          j        |fi |}	|                    |	           |                                 |r|                                 d
S )N-)r5    zFailed to read {}: {}FwTzFailed to open {}: {}zInvalid options: {}r   )rB   
parse_argsr   r   rE   stdinbufferr5   readdetachopenr<   	readlinesOSErrorrI   r   r   stdoutvarsr9   	formattervalidate_optionsr   rG   flushclose)
argsr@   wrapperdatafeclose_streamstreamformatter_optsss
             r   mainre      s   __FT""D}	 04=III	<<>>DNNGNN	Bdmdm<<< .wwq{{}}--. . . . . . . . . . . . . . . 	B 	B 	B'..t}a@@B B B B B B B B	B L| 	K$,dmDDDFLL 	K 	K 	K188qIIJJJJJJJJ	K $ZZN7!+<<^LL 7 7 7+22155666666667 	////A
LLOOO
LLNNN 1s   A> >BC3 3(C'C3 'C++C3 .C+/C3 3
D/='D*$D/*D/<E 
F%'FFF6G 
H !HHH)N)__doc__r6   rE   ior   r9   sqlparse.exceptionsr   rB   rI   re    r!   r   <module>rj      s      



        - - - - - -
{ { {|  ' ' ' ' ' 'r!   