
    Pig                    J    d Z ddlmZ ddlmZmZ ddlmZ dgZdddZ	ddZ
dS )a  
Find command handler for Dippy.

Find is mostly safe for searching, but has dangerous flags:
- -exec, -execdir: Execute arbitrary commands (delegates to inner command)
- -ok, -okdir: Interactive execution (always ask)
- -delete: Delete found files (always ask)
    )annotations)ClassificationHandlerContext)	bash_joinfindzexecute with promptz-okz-okdirctxr   returnr   c           
     Z   | j         }|r|d         nd}t          |          D ]\  }}|dv r6t                              |          }t	          d| d| d| d          c S |d	k    rt	          d| d
          c S |dv rg }t          |dz   t          |                    D ])}||         dv r n|                    ||                    *|st	          d| d|           c S t          |          }|d         }	t	          d|| d| d|	           c S t	          d|          S )zLClassify find command by examining exec flags and delegating inner commands.r   r   r   ask z ())descriptionz-deletez -delete)z-execz-execdir   );+delegate)inner_commandr   allow)	tokens	enumerateFLAG_CONTEXTgetr   rangelenappendr   )
r	   r   baseitokencontextinner_tokensj	inner_cmd
inner_names
             //root/projects/gits/Dippy/src/dippy/cli/find.pyclassifyr&      s   ZF*6!99FDf%%  5%%%"&&u--G!%5R5Ru5R5R5R5R5RSSSSSS I!%5F5F5FGGGGGG )))L1q5#f++.. / /!9
**E##F1I.... L%eD9J9J59J9JKKKKKK!,//I%aJ!'#::e::j::      *$ 't4444    N)r	   r   r
   r   )__doc__
__future__r   	dippy.clir   r   dippy.core.bashr   COMMANDSr   r&    r'   r%   <module>r.      s     # " " " " " 4 4 4 4 4 4 4 4 % % % % % %8 !# "5 "5 "5 "5 "5 "5r'   