
    vj                     v    d Z ddlZddlZddlZddlmZ  ej                  d      Zd Zd Z	e
dk(  r e	        yy)z
From the directory containing the static content for a trame application to work,
generate another application specific HTML file.
    N)Pathzdata-app-name="\w+"c                     t        | d      5 }|j                         }t        j                  d| d|      }t        |d      5 }|j	                  |       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nrzdata-app-name=""w)openreadAPP_PATTERNsubwrite)
input_fileoutput_fileapp_namef_incontentpatched_contentf_outs          </DATA/.local/lib/python3.12/site-packages/trame/tools/app.pycreate_app_filer      si    	j#	$))+%//OH:Q*GQ+s#uKK( $ 
	 $# 
	s#   7A3A'A3'A0	,A33A<c                  0   t        j                  d      } | j                  ddd       | j                  dd	       | j                         \  }}t	        |j
                        }|j                         s%| j                          t        j                  d
       |j                         r|dz  }|j                         s%| j                          t        j                  d
       |j                  |j                        }t        |||j                         y )Nz.HTML app file generator for trame applications)descriptionz--nametramez2Application name to encode inside HTML {name}.html)defaulthelpz--inputzInput file to use as template)r   r   z
index.html)argparseArgumentParseradd_argumentparse_known_argsr   inputexists
print_helpsysexitis_dir	with_stemnamer   )parserargs_r   r   s        r   mainr*      s    $$DF A   ,  
 %%'GD! djj!J,.
&&tyy1KJTYY7    __main__)__doc__r   rer"   pathlibr   compiler
   r   r*   __name__ r+   r   <module>r3      sH   
  	 
 bjj/0) 8F zF r+   