
    Pih                        d Z ddlmZ ddlmZmZ ddlmZ ddgZ e	h d          Z
 e	h d          Zh d	d
dhddhdZh dh ddZddZddZdS )zW
Kubectl command handler for Dippy.

Handles kubectl and similar Kubernetes CLI tools.
    )annotations)ClassificationHandlerContext)	bash_joinkubectlk>   api-versionscluster-infoapi-resourcesgettopauthdifflogswaitconfigpluginexplainversiondescribe	kustomize
completion>   port-forwardcprunseteditexecapplydebugdrainlabelpatchproxyscaletaintattachcordoncreatedeleteexposereplacerolloutannotateuncordon	autoscalecertificate>   	get-usersget-clustersget-contextscurrent-contextviewzcan-iwhoamistatushistory)r   r   r-   >
   delete-userset-clusterset-contextuse-contextdelete-clusterdelete-contextrename-contextset-credentialsr   use>   undopauseresumerestart)r   r-   tokens	list[str]returnlist[str] | Nonec                v    	 |                      d          }| |dz   d         }|r|ndS # t          $ r Y dS w xY w)z<Extract command from kubectl exec args (after -- separator).z--   N)index
ValueError)rG   sep_idxresults      2/root/projects/gits/Dippy/src/dippy/cli/kubectl.py_extract_exec_inner_commandrR   e   s[    ,,t$$!&)vvT)   tts   '* 
88ctxr   r   c                   | j         }|r|d         nd}t          |          dk     rt          d|          S d}d}|t          |          k     r0||         }|                    d          r|d	v r|dz  }:|dz  }@|}	 |st          d|          S |dz   t          |          k     r||dz   d         ng }| d
| }|t          v rE|rC|D ]@}|                    d          s)|t          |         v rt          d| d
|           c S  nA|t
          v rE|rC|D ]@}|                    d          s)|t
          |         v rt          d| d
|           c S  nA|t          v rt          d|          S |dk    rDt          |          }|r"t          |          }	t          d|	|d          S t          d|          S t          d|          S )zClassify kubectl command.r   r      ask)descriptionNrL   ->
   -f-l-n-o--output	--cluster	--context
--filename
--selector--namespace allowr   delegateT)inner_commandrW   remote)	rG   lenr   
startswithSAFE_SUBCOMMANDSUNSAFE_SUBCOMMANDSSAFE_ACTIONSrR   r   )
rS   rG   baseaction
action_idxtokenrestdescinner_tokens	inner_cmds
             rQ   classifyru   o   s   ZF-6!99ID
6{{Qe6666 FJ
s6{{
"
"z"C   	    a
!OJ 7e6666'1A~F'C'C6*q.""##DVD !!!d! 	 	E##C(( ,V444)'$?P?P?P?PQQQQQQ
 #### 	 	E##C(( .v666)%=N=Nu=N=NOOOOOO g48888 2488 	!,//I!)d    e6666%T2222    N)rG   rH   rI   rJ   )rS   r   rI   r   )__doc__
__future__r   	dippy.clir   r   dippy.core.bashr   COMMANDS	frozensetrl   UNSAFE_ACTIONSrj   rk   rR   ru    rv   rQ   <module>r      s)    # " " " " " 4 4 4 4 4 4 4 4 % % % % % %s y   .    B   h)$
 
    655  "   F3 F3 F3 F3 F3 F3rv   