bgEdZddlZddlZddlmZmZmZddlmZddl m Z dej de fd Z dej ddfd Zdej de fd Zdej de fd Zdejfd Zdej de fdZddeee defdZdS)ac CLI parsing for :command:`pysemver` command. Each command in :command:`pysemver` is mapped to a ``cmd_`` function. The :func:`main ` function calls :func:`createparser ` and :func:`process ` to parse and process all the commandline options. The result of each command is printed on stdout. N)castListOptional)Version) __version__argsreturncdddddd}|j|jdd gtj|j}t ||tt|j}t|S) z Subcommand: Bumps a version. Synopsis: bump can be major, minor, patch, prerelease, or build :param args: The parsed arguments :return: the new, bumped version bump_major bump_minor bump_patchbump_prerelease bump_build)majorminorpatch prereleasebuildNbumpz-h) rparser parse_argsrparseversiongetattrrstr)r maptableverfuncs [/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/semver/cli.pycmd_bumpr!s' H y ~... - % %C 3c49!5!56 7 7D ttvv;;cftj|jrdStd|jz)z Subcommand: Checks if a string is a valid semver version. Synopsis: check :param args: The parsed arguments NzInvalid version %r)ris_validr ValueErrorr s r cmd_checkr'1s4 %%t )DL8 9 99r"ctj|j}t||jS)z Subcommand: Compare two versions. Synopsis: compare :param args: The parsed arguments )rrversion1rcompareversion2)r ver1s r cmd_comparer->s1 = ' 'D t||DM** + ++r"ctj|j}t||jS)z Subcommand: Determines the next version, taking prereleases into account. Synopsis: nextver :param args: The parsed arguments )rrrr next_versionpart)r rs r cmd_nextverr1Js3mDL))G w##DI.. / //r"cftjtt}|dddt z|}|dd}|t |d d |d d |dd}|t |dd}|dd|dd|dd|dd|ddfD]}|dd|dd}|t |dd|d d!}|t |dd|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)titledestrz"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 raisecheckz,Checks if a string is a valid semver versionzVersion to checknextverz=Determines the next version, taking prereleases into account.r0z1One of 'major', 'minor', 'patch', or 'prerelease') argparseArgumentParser __package____doc__ add_argumentradd_subparsers add_parser set_defaultsr-r!r'r1)rsparser_compare parser_bumpsbp parser_checkparser_nextvers r createparserrJVs_  $+7 K K KF I{[/H A\\)2H\IIN[111 AAA 1ABBB,,v,=,>>K(+++  # #/ # G GB g$H II g$H II g$H II l)R SS g$H II ;; y'9::::<<D L9---i.@AAA\\W"N[111 0BCCCH  Mr"ct|ds'|jt||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&s r processrOsF 4     ll 99T??r"cliargsc t}||}||_t|}|t |dS#t t f$r'}t d|tjYd}~dSd}~wwxYw)z Entry point for the application script. :param list cliargs: Arguments to parse or None (=use :class:`sys.argv`) :return: error code r&NrERROR)file) rJrrrOprintr% TypeErrorsysstderr)rPrr resulterrs r mainr[s   g ..    &MMMq  " gs,,,,qqqqqsA AB BB)N)r>r;rWtypingrrrrr __about__r Namespacerr!r'r-r1r<rJrOintr[r"r rasw   ''''''''''""""""8%#8 :H& :4 : : : : ,h( ,S , , , , 0h( 0S 0 0 0 02h-2222j ($      (49%r"