
    hh5                     h    d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlmZ ddlm	Z	 d	dZ
d
dZy)z9General console printing utilities used by the Cloud SDK.    N)console_attr)console_pager)encoding)filesc                 2   t         j                  j                         sy| rt         j                  j                         sy|rt         j                  j                         sy|r4t        j                  d      }t        j                  d      }|s|r|dk(  ryy)a  Determines if the current terminal session is interactive.

  sys.stdin must be a terminal input stream.

  Args:
    output: If True then sys.stdout must also be a terminal output stream.
    error: If True then sys.stderr must also be a terminal output stream.
    heuristic: If True then we also do some additional heuristics to check if
               we are in an interactive context. Checking home path for example.

  Returns:
    True if the current terminal session is interactive.
  FHOMEHOMEPATH/T)sysstdinisattystdoutstderrosgetenv)outputerror	heuristichomehomepaths        U/var/www/html/dev/engine/venv/lib/python3.12/site-packages/fire/console/console_io.pyIsInteractiver      ss     
			CJJ%%'
3::$$& 99VDyy$HTTS[	    c                    t        d      s|j                  |        y|rt        j                  t        j
                  dd      }|dk(  rd}n"|s dD ]  }t        j                  |      s|} n |rXt        j                  t        j
                  dd      }d|xs d	z   }t        j                  t        j
                  d|       t        j                  t        j                  t        j                         t        j                  |t        j                  d
      }t        j                          j#                         }	|j%                  | j'                  |	             |j)                          t        j                  t        j                  t        j*                         |%t        j                  t        j
                  dd       yt-        j.                  | ||      j1                          y)a  Run a user specified pager or fall back to the internal pager.

  Args:
    contents: The entire contents of the text lines to page.
    out: The output stream.
    prompt: The page break prompt.
    check_pager: Checks the PAGER env var and uses it if True.
  T)r   NPAGER-)lesspagerLESSz-R )r   shell)input)r   writer   GetEncodedValuer   environr   FindExecutableOnPathSetEncodedValuesignalSIGINTSIG_IGN
subprocessPopenPIPEr   GetConsoleAttrGetEncodingcommunicateencodewaitSIG_DFLr   PagerRun)
contentsoutpromptcheck_pagerr   command	less_origr   pencs
             r   Morer>   D   sd    
d	#IIh
$$RZZ$?E|e& '%%g.%
  **2::vtDiY_"%drzz648 mmFMM6>>2


5
t
Da'')557cmm(//#.m/ffhmmFMM6>>2		  VT:hV,002r   )FFF)NT)__doc__r   r(   r+   r   fire.consoler   r   r   r   r   r>    r   r   <module>rB      s.     @ 	   
 % & ! $N*3r   