
    l:i                         d dl Z d dlZd dlmZmZmZmZmZ  ed      d        Zd Z	ed        Z
 ed      r  e ed            e
      Z
d Zy)    N)for_appeagerreplace_commandcachewhichgemc                 >    d| j                   v xr d| j                   v S )Nz7ERROR:  While executing gem ... (Gem::CommandLineError)zUnknown command)outputcommands    X/var/www/html/bot/venv/lib/python3.12/site-packages/thefuck/rules/gem_unknown_command.pymatchr      s'    E~~ 4!W^^35    c                 H    t        j                  d| j                        d   S )NzUnknown command (.*)$r   )refindallr
   r   s    r   _get_unknown_commandr      s    ::.?BBr   c               #   $  K   t        j                  g dt         j                        } | j                  j	                         D ]H  }|j                         }|j                  d      s%|j                         j                  d      d    J y w)N)r   helpcommands)stdoutz     r   )	
subprocessPopenPIPEr   	readlinesdecode
startswithstripsplit)proclines     r   _get_all_commandsr#      sq     7#-??4D %%' -{{}??6"**,$$S)!,,	-s   A&B)'Bc                 F    t        |       }t               }t        | ||      S )N)r   r#   r   )r   unknown_commandall_commandss      r   get_new_commandr'   !   s#    *73O$&L7O\BBr   )r   r   thefuck.utilsr   r   r   r   r   r   r   r#   r'    r   r   <module>r*      si    	  G G 	5 5C - - 	<+eEl+,=>Cr   