
    jiE                     F   S r SSKrSSKrSSKJrJrJr  SSKJr  SSK	J
r
  S\R                  S\4S	 jrS\R                  SS4S
 jrS\R                  S\4S jrS\R                  S\4S jrS\R"                  4S jrS\R                  S\4S jrSS\\\      S\4S jjrg)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                    SSSSSS.nU R                   c  U R                  R                  SS/5        [        R                  " U R
                  5      n[        X![        [        U R                   5         5      n[        U" 5       5      $ )	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buildbumpz-h)	r   parser
parse_argsr   parseversiongetattrr   str)r	   maptableverfuncs       *lib/python3.13/site-packages/semver/cli.pycmd_bumpr!      sv     'H yy 	~.
--
%C3c499!567Dtv;    c                 ~    [         R                  " U R                  5      (       a  g[        SU R                  -  5      e)zy
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   s1     %%
)DLL8
99r"   c                     [         R                  " U R                  5      n[        UR	                  U R
                  5      5      $ )zo
Subcommand: Compare two versions.

Synopsis: compare <VERSION1> <VERSION2>

:param args: The parsed arguments
)r   r   version1r   compareversion2)r	   ver1s     r    cmd_comparer-   >   s.     =='Dt||DMM*++r"   c                     [         R                  " U R                  5      n[        UR	                  U R
                  5      5      $ )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   s0     mmDLL)Gw##DII.//r"   c            	      0   [         R                  " [        [        S9n U R	                  SSS[
        -   S9  U R                  5       nUR                  SSS9nUR                  [        S	9  UR	                  S
SS9  UR	                  SSS9  UR                  SSS9nUR                  [        S	9  UR                  SSS9nUR                  SSS9UR                  SSS9UR                  SSS9UR                  SSS9UR                  SSS94 H  nUR	                  SSS9  M     UR                  SSS9nUR                  [        S	9  UR	                  SSS9  UR                  S S!S9nUR                  [        S	9  UR	                  SSS9  UR	                  S"S#S9  U $ )$zP
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KF
I{[/H   	A\\)2H\IN[1
A
1AB ,,v,=,>K(+		#	#/	#	GB 	g$HI
g$HI
g$HI
l)RS
g$HI 	
y'9: <<D   L 9-i.@A \\W " N [1	0BCH    Mr"   c                     [        U S5      (       d$  U R                  R                  5         [        5       eU R	                  U 5      $ )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      s9     4   l 99T?r"   cliargsc                      [        5       nUR                  U S9nXl        [        U5      nUb  [	        U5        g! [
        [        4 a#  n[	        SU[        R                  S9   SnAgSnAff = f)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[      sg      g .&M	" gs,s   8; A.A))A.)N)r>   r;   rW   typingr   r   r   r   r   	__about__r   	Namespacer   r!   r'   r-   r1   r<   rJ   rO   intr[    r"   r    <module>ra      s   
  
 ' '  "8%% # 8
:H&& 
:4 
:	,h(( 	,S 	,	0h(( 	0S 	02h-- 2j($$   (49%  r"   