
    l:i
                     J    d dl Z d dlmZmZ ddlmZ ddlmZ  G d de      Z	y)    N)ArgumentParserSUPPRESS   )ARGUMENT_PLACEHOLDER)	get_aliasc                   :    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
y	)
ParserzQArgument parser that can handle arguments with our special
    placeholder.

    c                 H    t        dd      | _        | j                          y )NthefuckF)progadd_help)r   _parser_add_argumentsselfs    N/var/www/html/bot/venv/lib/python3.12/site-packages/thefuck/argument_parser.py__init__zParser.__init__   s    %9uE    c                 (   | j                   j                  dddd       | j                   j                  dddt               d	
       | j                   j                  dddd       | j                   j                  ddd       | j                   j                  dddd       | j                          | j                   j                  dddd       | j                   j                  ddt               | j                   j                  ddd       y)zAdds arguments to parser.z-vz	--version
store_truez&show program's version number and exitactionhelpz-az--alias?z2[custom-alias-name] prints alias for current shell)nargsconstr   z-lz--shell-loggerstorezlog shell output to the filez"--enable-experimental-instant-modez6enable experimental instant mode, use on your own riskz-hz--helpzshow this help message and exitz-dz--debugzenable debug outputz--force-commandcommand*zcommand that should be fixed)r   r   N)r   add_argumentr   _add_conflicting_argumentsr   r   s    r   r   zParser._add_arguments   s.   !!+9 	" 	; 	!!)+E	 	" 	G
 	!!"/ 	" 	1 	!!0I 	" 	K 	!!(2 	" 	4 	'')!!)& 	" 	( 	!! 	" 	 	!!/ 	" 	1r   c                     | j                   j                         }|j                  dddddd       |j                  dd	dd
       y)z1It's too dangerous to use `-y` and `-r` together.z-yz--yesz--yeahz--hardr   z*execute fixed command without confirmationr   z-rz--repeatzrepeat on failureN)r   add_mutually_exclusive_groupr    )r   groups     r   r!   z!Parser._add_conflicting_arguments6   sV    99;'8X= 	 	? 	*$ 	 	&r   c                     t         |v r'|j                  t               }||dz   d dgz   |d| z   S |r"|d   j                  d      s|d   dk7  rdg|z   S |S )a  Prepares arguments by:

        - removing placeholder and moving arguments after it to beginning,
          we need this to distinguish arguments from `command` with ours;

        - adding `--` before `command`, so our parse would ignore arguments
          of `command`.

        r   Nz--r   -)r   index
startswith)r   argvr'   s      r   _prepare_argumentszParser._prepare_argumentsB   sm      4'JJ34E	
#tf,tFU|;;$q',,S1d1go6D= Kr   c                 `    | j                  |dd        }| j                  j                  |      S )Nr   )r*   r   
parse_args)r   r)   	argumentss      r   parsezParser.parseT   s-    ++DH5	||&&y11r   c                 V    | j                   j                  t        j                         y N)r   print_usagesysstderrr   s    r   r1   zParser.print_usageX   s      ,r   c                 V    | j                   j                  t        j                         y r0   )r   
print_helpr2   r3   r   s    r   r5   zParser.print_help[   s    

+r   N)__name__
__module____qualname____doc__r   r   r!   r*   r.   r1   r5    r   r   r	   r	      s+    
#1J
&$2-,r   r	   )
r2   argparser   r   r   r   utilsr   objectr	   r:   r   r   <module>r>      s    
 - ' U,V U,r   