o �J�hE�@s�dZddlZddlZddlmZmZmZddlmZddl m Z dej de fd d �Z dej ddfd d �Zdej de fd d�Zdej de fdd�Zdejfdd�Zdej de fdd�Zddeee defdd�ZdS)ac CLI parsing for :command:`pysemver` command. Each command in :command:`pysemver` is mapped to a ``cmd_`` function. The :func:`main <semver.cli.main>` function calls :func:`createparser <semver.cli.createparser>` and :func:`process <semver.cli.process>` to parse and process all the commandline options. The result of each command is printed on stdout. �N)�cast�List�Optional�)�Version)� __version__�args�returncCsVdddddd�}|jdur|j�dd g�t�|j�}t||tt|j��}t|��S) z� Subcommand: Bumps a version. Synopsis: bump <PART> <VERSION> <PART> can be major, minor, patch, prerelease, or build :param args: The parsed arguments :return: the new, bumped version � bump_major� bump_minor� bump_patch�bump_prerelease� bump_build)�major�minor�patch� prerelease�buildN�bumpz-h) r�parser� parse_argsr�parse�version�getattrr�str)rZmaptable�ver�func�r�HC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\semver\cli.py�cmd_bumps �   rcCst�|j�rdStd|j��)z� Subcommand: Checks if a string is a valid semver version. Synopsis: check <VERSION> :param args: The parsed arguments NzInvalid version %r)r�is_validr� ValueError�rrrr� cmd_check1s r#cC�t�|j�}t|�|j��S)z Subcommand: Compare two versions. Synopsis: compare <VERSION1> <VERSION2> :param args: The parsed arguments )rr�version1r�compare�version2)r�ver1rrr� cmd_compare>� r)cCr$)z� Subcommand: Determines the next version, taking prereleases into account. Synopsis: nextver <VERSION> <PART> :param args: The parsed arguments )rrrrZ next_version�part)rrrrr� cmd_nextverJr*r,cCs>tjttd�}|jdddtd�|��}|jddd�}|jt d �|jd d d�|jd d d�|jddd�}|jt d �|jddd�}|jddd�|jddd�|jddd�|jddd�|jddd�fD] }|jddd�qd|jddd�}|jt d �|jddd�|jd d!d�}|jt d �|jddd�|jd"d#d�|S)$z\ Create an :class:`argparse.ArgumentParser` instance. :return: parser instance )�prog� descriptionz --versionrz %(prog)s )�actionrr&zCompare two versions)�help)rr%z First versionr'zSecond versionrzBumps a versionz Bump commands)�title�destrz"Bump the major part of the versionrz"Bump the minor part of the versionrz"Bump the patch part of the versionrz'Bump the prerelease part of the versionrz"Bump the build part of the versionzVersion to raise�checkz,Checks if a string is a valid semver versionzVersion to checkZnextverz=Determines the next version, taking prereleases into account.r+z1One of 'major', 'minor', 'patch', or 'prerelease') �argparse�ArgumentParser� __package__�__doc__� add_argumentr�add_subparsers� add_parser� set_defaultsr)rr#r,)r�sZparser_compareZ parser_bump�sb�pZ parser_checkZparser_nextverrrr� createparserVsB �       �� � �r?cCs$t|d�s |j��t��|�|�S)z� Process the input from the CLI. :param args: The parsed arguments :param parser: the parser instance :return: result of the selected action r)�hasattrr� print_help� SystemExitrr"rrr�process�s   rC�cliargsc Csrzt�}|j|d�}||_t|�}|durt|�WdSttfy8}ztd|tjd�WYd}~dSd}~ww)z� Entry point for the application script. :param list cliargs: Arguments to parse or None (=use :class:`sys.argv`) :return: error code r"Nr�ERROR)�file�) r?rrrC�printr!� TypeError�sys�stderr)rDrr�result�errrrr�main�s ��rN)N)r7r4rJ�typingrrrrr� __about__r� Namespacerrr#r)r,r5r?rC�intrNrrrr�<module>s      5 
Memory