§
    P­·i>  ã                  ó<   — d Z ddlmZ ddlmZmZ dgZdd	„Zdd„ZdS )zb
Sort command handler for Dippy.

Sort is safe for text processing, but -o flag writes to a file.
é    )Úannotations)ÚClassificationÚHandlerContextÚsortÚtokensú	list[str]Úreturnú
str | Nonec                ó¶  — d}|t          | ¦  «        k     rÃ| |         }|dk    r#|dz   t          | ¦  «        k     r| |dz            S dS |                     d¦  «        rt          |¦  «        dk    r
|dd…         S |dk    r#|dz   t          | ¦  «        k     r| |dz            S dS |                     d¦  «        r
|dd…         S |dz  }|t          | ¦  «        k     °ÃdS )z.Extract the output file from -o/--output flag.é   z-oNé   z--outputz	--output=é	   )ÚlenÚ
startswith)r   ÚiÚts      ú//root/projects/gits/Dippy/src/dippy/cli/sort.pyÚ_extract_output_filer      sö   € à	€AØ
c&‰kŒkŠ/ˆ/Ø1ŒIˆð Š9ˆ9Ø1‰u•s˜6‘{”{Ò"Ð"Ø˜a !™e”}Ð$Ø4Ø<Š<˜ÑÔð 	¥# a¡&¤&¨1¢* *ØQRR”5ˆLð 
Š?ˆ?Ø1‰u•s˜6‘{”{Ò"Ð"Ø˜a !™e”}Ð$Ø4Ø<Š<˜Ñ$Ô$ð 	ØQRR”5ˆLà	ˆQ‰ˆð' c&‰kŒkŠ/ˆ/ð* ˆ4ó    Úctxr   r   c                ó˜   — | j         }|r|d         nd}t          |¦  «        }|rt          d|› d|f¬¦  «        S t          d|¬¦  «        S )z2Classify sort command (no output to file is safe).r   r   Úallowz -o (write to file))ÚdescriptionÚredirect_targets)r   )r   r   r   )r   r   ÚbaseÚoutput_files       r   Úclassifyr   )   sp   € àŒZ€FØÐ*ˆ6!Œ9ˆ9 F€Då& vÑ.Ô.€Kàð 
ÝØØÐ4Ð4Ð4Ø)˜^ð
ñ 
ô 
ð 	
õ ˜'¨tÐ4Ñ4Ô4Ð4r   N)r   r   r	   r
   )r   r   r	   r   )	Ú__doc__Ú
__future__r   Ú	dippy.clir   r   ÚCOMMANDSr   r   © r   r   ú<module>r#      st   ððð ð #Ð "Ð "Ð "Ð "Ð "à 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4àˆ8€ðð ð ð ð65ð 5ð 5ð 5ð 5ð 5r   