
    PiB	                    ^    d Z ddlmZ ddlmZmZ dgZ eh d          Zdd
Z	ddZ
ddZdS )a  
Plutil command handler for Dippy.

macOS property list utility.
- -p (print) and -lint (check syntax) are safe
- -convert modifies files (in-place or with -o)
- -insert, -replace, -remove modify plist contents
- -extract just prints extracted value (safe)
    )annotations)ClassificationHandlerContextplutil>   -insert-remove-convert-replacetokens	list[str]return
str | Nonec                    t          |           D ].\  }}|dk    r#|dz   t          |           k     r| |dz            c S /dS )z%Extract the output file from -o flag.-o   N)	enumeratelen)r   its      1/root/projects/gits/Dippy/src/dippy/cli/plutil.py_extract_output_filer      sT    &!! ! !199QV,,!a%=   4    c                    g }d}|t          |           k     rZ| |         }|dv r|dz  }%|                    d          r|dz  }@|                    |           |dz  }|t          |           k     Z|S )z4Extract input files that would be modified in-place.r   >   -type-extractr   r   r   r	   r
      -)r   
startswithappend)r   filesr   r   s       r   _extract_input_filesr!      s    E	A
c&kk//1I 
 
 
 FA<< 	FAQ	Q) c&kk//* Lr   ctxr   r   c                R   | j         }d}d}|dd         D ]}|t          v rd}|} n|st          dd          S t          |          }|rt          dd| |f	          S t	          |          }|r"t          dd| t          |          	          S t          d
d|           S )zClassify plutil command.FNr   Tallowr   )descriptionzplutil )r%   redirect_targetsask)r   UNSAFE_ACTIONSr   r   r!   tuple)r"   r   has_unsafe_actionactionr   output_fileinput_filess          r   classifyr.   9   s   ZFFABBZ   $FE   =g8<<<<&v..K 
*&**)^
 
 
 	
 'v..K 
*&**";//
 
 
 	

 %-?v-?-?@@@@r   N)r   r   r   r   )r   r   r   r   )r"   r   r   r   )__doc__
__future__r   	dippy.clir   r   COMMANDS	frozensetr(   r   r!   r.    r   r   <module>r5      s     # " " " " " 4 4 4 4 4 4 4 4: IIIJJ      8A A A A A Ar   