o
    ;i                     @   s  d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlm	Z	 ddl
mZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z) ddl*m+Z+ de,fddZ-ej.ddddddgidd Z/e/j0d!d"ej1dd#e-d$fd%ej2d&e,fd'd(Z3d)d* Z4ej5d@d+ee6 fd,d-Z7e/j8d.d!d/ej9 e/j8d0d!d/ej: e/8d1ej e/;e e/j;ed2d3 e/j;ed2d3 e/j;ed2d!d4 e/j;ed5d3 e/j;e d5d!d4 e/j;e&d5d3 e/j;e$d5d3 e/j;e+d5d3 e/j;ed6d3 e/j;ed6d3 e/j;e"d6d3 e/j;e)d6d3 e/j;ed7d3 e/j8d8d7d3e e/j8d-d9d:d;e7 ej<=e/Z>e>j?ejd<d= e>@d eAd>krd d?lmBZB eB  e>  W d   dS 1 sw   Y  dS dS )A    N)Optional)Rule)synchronizer)OutputManager   )runshell)app_cli)billing_cli)cluster_cli)
config_cli)container_cli)	dashboard)dict_cli)environment_cli)
launch_cli)nfs_cli)profile_cli)	queue_cli)
secret_cli)
_new_token	token_cli)
volume_clivaluec                 C   s,   | rddl m} td|  t d S )Nr   )__version__zmodal client version: )modal_versionr   typerechoExit)r   r    r   I/home/ubuntu/.local/lib/python3.10/site-packages/modal/cli/entry_point.pyversion_callback   s
   r!   Fmarkdownhelp_option_namesz-h--helpz
    Modal is the fastest way to run code in the cloud.

    See the website at https://modal.com/ for documentation and more information
    about running code on Modal.
    )no_args_is_helpadd_completionrich_markup_modecontext_settingshelpT)invoke_without_commandz	--version)callbackctxversionc                 C   s(   | j d u rt |   t d S N)invoked_subcommandr   getprintget_helpr   r   )r,   r-   r   r   r    modal3   s   
r3   c                  C   s   d} zt jddgdd W dS  ty   d}Y n ty#   d}Y nw |d	|  d
|  d7 }t }|| |tdd dS )z@Checks whether the `modal` executable is on the path and usable.zEhttps://modal.com/docs/guide/troubleshooting#command-not-found-errorsr3   r$   T)capture_outputNz[red]The `[white]modal[/white]` command was not found on your path!
You may need to add it to your path or use `[white]python -m modal[/white]` as a workaround.[/red]
z[red]The `[white]modal[/white]` command is not executable!
You may need to give it permissions or use `[white]python -m modal[/white]` as a workaround.[/red]
z"See more information here:

[link=]z[/link]
white)style)
subprocessr   FileNotFoundErrorPermissionErrorr   r0   r1   r   )urltextoutputr   r   r    
check_path@   s   
r>   profilec                    s6   t   d}t j|ddd t| ddI d H  d S )Nay  
           #############        #############
          ####         ##      ####         ##
         ##  ##         ##    ##  ##         ##
        ##    ##         ##  ##    ##         ##
       ##      ##         ####      ##         ##
      ##        #############        ##         ##
     ##        ##         ####        ##         ##
    ##        ##         ##  ##        ##         ##
   ##        ##         ##    ##        ##         ##
  ##        ##         ##      ##        ##         ##
 ##        ##         ##        ##        ##         ##
##        ##         ##          ##        #############
 ##      ##         ##            ##      ##         ##
  ##    ##         ##              ##    ##         ##
   ##  ##         ##                ##  ##         ##
    ####         ##                  ####         ##
     #############                    #############
Fgreen)	highlightr7   z/home)r?   next_url)r>   r   r0   r1   r   )r?   artr   r   r    setupW   s
   rD   deploy)r%   server   Deployments)rich_help_panel)rH   hiddenStorageConfigurationObservabilityr   z Bootstrap Modal's configuration.
Onboarding)r)   rH   r   )name__main__)enable_outputr.   )Cr8   typingr   r   	rich.ruler   modal._utils.async_utilsr   modal.outputr    r   r   shell_moduleappr	   billingr
   clusterr   configr   	containerr   r   dictr   environmentr   launchr   network_file_systemr   r?   r   queuesr   secretr   tokenr   r   volumer   boolr!   Typerentrypoint_cli_typerr+   OptionContextr3   r>   create_blockingstrrD   commandrE   rF   	add_typermainget_commandentrypoint_cliadd_commandlist_commands__name__rP   r   r   r   r    <module>   s   




$