
    Pi                        d Z ddlmZ ddlmZmZ ddgZ eh d          Z eh d          Z	h dh d	d
Z
h dddhd
ZddZddZdS )zW
Terraform command handler for Dippy.

Handles terraform and tofu (OpenTofu) commands.
    )annotations)ClassificationHandlerContext	terraformtf>   fmtgethelpplanshowtestgraphstateoutputconsolemodulesrefreshversionmetadatavalidate	providers	workspace>   initapplylogintaintimportlogoutdestroyuntaint>   listpullr   >   r!   r   select)r   r   >   replace-providermvrmpushnewdeletectxr   returnr   c                   | j         }|r|d         nd}t          |          dk     rt          d|          S d|v sd|v sd|v rt          d	| 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 rt|rrt          |          }|ra| d| }	|t          |         v rt          d	|	          S |t                              |t                                v rt          d|	          S |t          v r8|r6t          |          }|r%|t          |         v rt          d| d|           S |t          v rt          d	|          S t          d|          S )zClassify terraform command.r   r      ask)descriptionz-helpz--helpz-hallowz --helpN   ->   -var-chdir	-var-file )
tokenslenr   
startswithSAFE_SUBCOMMANDS_find_subcommandUNSAFE_SUBCOMMANDSr	   setSAFE_ACTIONS)
r*   r7   baseaction
action_idxtokenrestdesc
subcommandsub_descs
             4/root/projects/gits/Dippy/src/dippy/cli/terraform.pyclassifyrH   A   sZ   ZF/6!99KD
6{{Qe6666 &H..$&..gd3C3C3CDDDD FJ
s6{{
"
"z"C   	777a
!OJ 7e6666'1A~F'C'C6*q.""##DVD !!!d!%d++
 	C----H-f555%g8DDDD/33FCEEBBBB%eBBBB####%d++
 	M*(:6(BBB!%5K5Kz5K5KLLLL g48888%T2222    rC   	list[str]
str | Nonec                B    | D ]}|                     d          s|c S dS )z/Find the first non-flag token (the subcommand).r2   N)r9   )rC   rB   s     rG   r;   r;   y   s:      $$ 	LLL	4rI   N)r*   r   r+   r   )rC   rJ   r+   rK   )__doc__
__future__r   	dippy.clir   r   COMMANDS	frozensetr>   UNSAFE_ACTIONSr:   r<   rH   r;    rI   rG   <module>rT      s     # " " " " " 4 4 4 4 4 4 4 4 y   0 	 	 	  &%%+++   655"  53 53 53 53p     rI   