
    l:i                     F    d Z ddlZddlmZ ej                  d        Zd Zy)zH This file provide some utility functions for Arch Linux specific rules.    N   )utilsc                    	 | j                         } | j                  d      r| dd } | j                  d      d   } t        j                  ddd| gd	t
        j                  
      j                         }|D cg c]  }|j                         d    c}S c c}w # t        j                  $ r,}|j                  dk(  r|j                  dk(  rg cY d}~S |d}~ww xY w)z Gets the packages that provide the given command using `pkgfile`.

    If the command is of the form `sudo foo`, searches for the `foo` command
    instead.
    zsudo    N r   pkgfilez-bz-vT)universal_newlinesstderr    )strip
startswithsplit
subprocesscheck_outputr   DEVNULL
splitlinesCalledProcessError
returncodeoutput)commandpackagespackageerrs       Q/var/www/html/bot/venv/lib/python3.12/site-packages/thefuck/specific/archlinux.pyget_pkgfiler      s    --/g&abkG--$Q'**dG,#EMM
 *, 	
 3;;w";;;(( >>Q3::#3II	s6   A6B 8BB B C-CCCCc                      t        j                  d      rd} n1t        j                  d      rd} nt        j                  d      rd} nyt        j                  d      }|| fS )Nyayyaourtpacmanzsudo pacman)FNr   )r   which)r    enabled_by_defaults     r   archlinux_envr#   "   sR    {{5	X		X	Y/v%%    )__doc__r   r   r   memoizer   r#    r$   r   <module>r(      s+    N    6&r$   