a
    ý<ã`  ã                   @   s,   d Z ddlZddlZe d¡Zddd„ZdS )zHCollection of utilities for command-line interfaces and console scripts.é    Nz#\d+$Fc           	      C   s    t j | ¡\}}t j |¡\}}|r(|}t |¡d }|du rNt j | ¡d }t j ||| ¡}d}|sœt j |¡rœt j ||d t|ƒ | ¡}|d7 }qh|S )a‘  Generates a suitable file name for writing output.

    Often tools will want to take a file, do some kind of transformation to it,
    and write it out again. This function determines an appropriate name for the
    output file, through one or more of the following steps:

    - changing the output directory
    - replacing the file extension
    - suffixing the filename with a number (``#1``, ``#2``, etc.) to avoid
      overwriting an existing file.

    Args:
        input: Name of input file.
        outputDir: Optionally, a new directory to write the file into.
        extension: Optionally, a replacement for the current file extension.
        overWrite: Overwriting an existing file is permitted if true; if false
            and the proposed filename exists, a new name will be generated by
            adding an appropriate number suffix.

    Returns:
        str: Suitable output filename
    r   Né   ú#)ÚosÚpathÚsplitÚsplitextÚnumberAddedREÚjoinÚexistsÚrepr)	ÚinputZ	outputDirÚ	extensionZ	overWriteZdirNameZfileNameÚextÚoutputÚn© r   ú6lib/python3.9/site-packages/fontTools/misc/cliTools.pyÚmakeOutputFileName	   s     ÿ
r   )NNF)Ú__doc__r   ÚreÚcompiler   r   r   r   r   r   Ú<module>   s   
