
    Pi                    D    d Z ddlmZ ddlmZmZ dgZdd	ZddZddZ	dS )z
Compression_tool command handler for Dippy.

macOS compression utility using the Compression library.
- -encode/-decode compress/decompress data
- Without -o, writes to stdout (safe)
- With -o, writes to specified file
    )annotations)ClassificationHandlerContextcompression_tooltokens	list[str]return
str | Nonec                ~    t          |           D ],\  }}|dv r#|dz   t          |           k     r| |dz            c S -dS )z)Extract the output file from -o/--o flag.>   -o--o   N)	enumeratelen)r   its      ;/root/projects/gits/Dippy/src/dippy/cli/compression_tool.py_extract_output_filer      sV    &!! ! !1!a%#f++"5"5!a%=   4    boolc                .    | dd         D ]	}|dv r dS 
dS )z'Check if -encode or -decode is present.r   N>   -decode-encode--decode--encodeTF )r   r   s     r   _has_operationr      s6    ABBZ  >>>44 ?5r   ctxr   r   c                    | j         }d|v sd|v rt          dd          S t          |          st          dd          S t          |          }|rt          dd|f          S t          dd          S )z"Classify compression_tool command.z-hz--hallowr   )description)r!   redirect_targets)r   r   r   r   )r   r   output_files      r   classifyr$   !   s    ZFv~~&g3EFFFF&!! Gg3EFFFF&v..K 
*)^
 
 
 	
 '/ABBBBr   N)r   r   r	   r
   )r   r   r	   r   )r   r   r	   r   )
__doc__
__future__r   	dippy.clir   r   COMMANDSr   r   r$   r   r   r   <module>r)      s     # " " " " " 4 4 4 4 4 4 4 4      C C C C C Cr   