
    .PhE                        d Z ddlZddlZddlmZmZmZ ddlmZ ddl	m
Z
 dej        defd	Zdej        ddfd
Zdej        defdZdej        defdZdej        fdZdej        defdZddeee                  defdZdS )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returnc                    dddddd}| j         | j                            dd	g           t          j        | j                  }t          ||t          t          | 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)r	   maptableverfuncs       J/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/semver/cli.pycmd_bumpr!      s     ' H y 	~...
-
%
%C3c49!5!5677Dttvv;;    c                 f    t          j        | j                  rdS t          d| j        z            )z
    Subcommand: Checks if a string is a valid semver version.

    Synopsis: check <VERSION>

    :param args: The parsed arguments
    NzInvalid version %r)r   is_validr   
ValueErrorr	   s    r    	cmd_checkr'   1   s4     %% t
)DL8
9
99r"   c                     t          j        | j                  }t          |                    | j                            S )z
    Subcommand: Compare two versions.

    Synopsis: compare <VERSION1> <VERSION2>

    :param args: The parsed arguments
    )r   r   version1r   compareversion2)r	   ver1s     r    cmd_comparer-   >   s1     =''Dt||DM**+++r"   c                     t          j        | j                  }t          |                    | j                            S )z
    Subcommand: Determines the next version, taking prereleases into account.

    Synopsis: nextver <VERSION> <PART>

    :param args: The parsed arguments
    )r   r   r   r   next_versionpart)r	   r   s     r    cmd_nextverr1   J   s3     mDL))Gw##DI..///r"   c                  f   t          j        t          t                    } |                     dddt
          z              |                                 }|                    dd          }|                    t          	           |                    d
d           |                    dd           |                    dd          }|                    t          	           |                    dd          }|                    dd          |                    dd          |                    dd          |                    dd          |                    dd          fD ]}|                    dd           |                    dd          }|                    t          	           |                    dd           |                    d d!          }|                    t          	           |                    dd           |                    d"d#           | S )$z\
    Create an :class:`argparse.ArgumentParser` instance.

    :return: parser instance
    )progdescriptionz	--versionr   z	%(prog)s )actionr   r*   zCompare two versions)help)r   r)   zFirst versionr+   zSecond versionr   zBumps a versionzBump commands)titledestr   z"Bump the major part of the versionr   z"Bump the minor part of the versionr   z"Bump the patch part of the versionr   z'Bump the prerelease part of the versionr   z"Bump the build part of the versionzVersion to raisecheckz,Checks if a string is a valid semver versionzVersion to checknextverz=Determines the next version, taking prereleases into account.r0   z1One of 'major', 'minor', 'patch', or 'prerelease')argparseArgumentParser__package____doc__add_argumentr   add_subparsers
add_parserset_defaultsr-   r!   r'   r1   )r   sparser_compareparser_bumpsbpparser_checkparser_nextvers           r    createparserrJ   V   s_    $+7KKKF
I{[/H     	A\\)2H\IIN[111
AAA
1ABBB ,,v,=,>>K(+++		#	#/	#	G	GB 	g$HII
g$HII
g$HII
l)RSS
g$HII ; ; 	
y'9:::: <<D    L 9---i.@AAA \\W "  N [111	0BCCCH      Mr"   c                     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
SystemExitr   r&   s    r    processrO      sF     4      ll 99T??r"   cliargsc                    	 t                      }|                    |           }||_        t          |          }|t	          |           dS # t
          t          f$ r'}t	          d|t          j                   Y d}~dS d}~ww xY w)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   )	rJ   r   r   rO   printr%   	TypeErrorsysstderr)rP   r   r	   resulterrs        r    mainr[      s      g ..&MMMq	"   gs,,,,qqqqqs   AA B BB)N)r>   r;   rW   typingr   r   r   r   r   	__about__r   	Namespacer   r!   r'   r-   r1   r<   rJ   rO   intr[    r"   r    <module>ra      sw  
 
  



 ' ' ' ' ' ' ' ' ' '       " " " " " "8% #    8
:H& 
:4 
: 
: 
: 
:	,h( 	,S 	, 	, 	, 	,	0h( 	0S 	0 	0 	0 	02h- 2 2 2 2j($       (49%       r"   