%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/certbot/_internal/cli/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/certbot/_internal/cli/__pycache__/helpful.cpython-312.pyc

�

M/�e�X��t�dZddlZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZddlZdd
l
mZddl
mZddl
mZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z#ddl$m%Z%ddl&m'Z'ddl&m(Z(Gd�d�Z)y)z$Certbot command line argument parser�N)�Any)�Dict)�Iterable)�List)�Optional)�Tuple)�Union)�crypto_util)�errors)�util)�	constants)�hooks)�COMMAND_OVERVIEW)�HELP_AND_VERSION_USAGE)�SHORT_USAGE)�add_domains)�CustomHelpFormatter)�flag_default)�HelpfulArgumentGroup)�set_test_server_options)�	VERB_HELP)�
VERB_HELP_MAP)�obj)�disco)�ArgumentSource)�NamespaceConfigc	��eZdZdZdeedeeddfd�Zgd�Zdefd�Z	deed	e
eefdefd
�Zde
ddfd�Zdeeeffd
�Zdedej&fd�Zde
fd�Zde
ddfd�Zde
ddfd�Zd$d�Zdedeeede
eeffd�Zdee
eeeefdededdfd�Zdee
eeeefdededej&fd�Zdededdfd�Zd%dedeedede fd �Z!de"jFddfd!�Z$d"e
eefdeeeeffd#�Z%y)&�HelpfulArgumentParserz�Argparse Wrapper.

    This class wraps argparse, adding the ability to make --help less
    verbose, and request help on specific subcategories at a time, eg
    'certbot --help security' for security options.

    �args�plugins�returnNc���ddlm}id|j�d|j�d|j�d|j�d|j
�d|j�d	|j�d
|j�d|j�d|j�d
|j�d|j�d|j�d|j�d|j�d|j�d|j �d|j"i�|_t'j(t*j,�j.|_g|_gd�}|t5|j$�|j6zdgzz
}t5|�}||zdgz|_||_|j:r!|j:ddk(rd|j:d<|j=�|j?d|j8�}|j?d|j8�}|tA|tB�rtA|tB�r|xs||_"ntA|tF�r|n||_"|jI||jD�}|jK|jD�|_&i|_'tQjRd|tTddgtWd�djYdj[tWd���� �|_.d!|j\_/|y)"Nr)�main�auth�certonly�run�installr �register�update_account�show_account�
unregister�renew�revoke�rollback�
everything�update_symlinks�certificates�delete�enhance�reconfigure)�all�security�paths�
automation�testing�manage�help�--help�-h�certbot�-c�--config�config_filesz"path to config file (default: {0})z and )�prog�usage�formatter_class�args_for_setting_config_path�default_config_files�config_arg_help_messageF)0�certbot._internalr#r%r&r'�plugins_cmdr(r)r*r+r,r-r.r0r1r2r3r4�VERBS�display_obj�NoninteractiveDisplay�sys�stdout�notification�notify�actions�list�COMMANDS_TOPICS�help_topicsr�determine_verb�prescan_for_flag�
isinstance�bool�help_arg�str�
_usage_string�determine_help_topics�visible_topics�groups�configargparse�	ArgParserrr�format�join�parser�_add_config_file_help)	�selfrr r#�HELP_TOPICS�plugin_names�help1�help2�short_usages	         �?/usr/lib/python3/dist-packages/certbot/_internal/cli/helpful.py�__init__zHelpfulArgumentParser.__init__-s���*�
��D�M�M�
���
�
�
�
�4�8�8�
�
�t�|�|�	
�

�t�'�'�
�
��
�
�

�
�d�1�1�
�
�D�-�-�
�
�$�/�/�
�
�T�Z�Z�
�
�d�k�k�
�
��
�
�
�
�$�(�(�
�
�t�3�3�
�
�D�-�-�
� 
�d�k�k�!
�"
�t�|�|�#
�$
�4�+�+�%
��
�,"�7�7��
�
�C�P�P���46���,a���t�D�J�J�'�$�*>�*>�>�(��K�K��,0��M��0;�l�0J�d�V�0S�����	��9�9����1���/�#�D�I�I�a�L������%�%�d�D�,<�,<�=���%�%�h��0@�0@�A����e�T�"�z�%��'>�!�N�U�D�M�%/��s�%;�E��D�M��(�(��$�-�-�@��"�8�8����G���;=���$�.�.���/�*.�
�);�!-�n�!=�$H�$O�$O����\�.�9�:�%<�
=���-2����)��)�command�commands�
subcommand�subcommands�verbsc��td�tD��}d}tt�D].\}}|j	dd�}|dj|||��z
}�0|dz
}|S)Nc3�2K�|]}t|����y�w�N)�len)�.0�vs  rk�	<genexpr>z:HelpfulArgumentParser._list_subcommands.<locals>.<genexpr>ws����4��c�!�f�4�s�z,The full list of available SUBCOMMANDS is:

�short�z{0:<{length}}     {1}
)�lengthzG
You can get more help on a specific subcommand with --help SUBCOMMAND
)�maxr�sortedr�getra)re�longest�text�verb�props�docs      rk�_list_subcommandsz'HelpfulArgumentParser._list_subcommandsvsp���4�m�4�4��?��!�)�,�	P�K�D�%��)�)�G�R�(�C��-�4�4�T�3�w�4�O�O�D�	P�	
�[�[���rmrYc���d|vrd}nd}d|vrd}nd}t}|dur;|j|t||fzztz�t	j
d�|S||jvr9|j||j�z�t	j
d�|S|d	k(r|t||fzz
}|St|t�r,tj|i�jd
d�}|r|n|}|S)a#Make usage strings late so that plugins can be initialised late

        :param plugins: all discovered plugins
        :param help_arg: False for none; True for --help; "TOPIC" for --help TOPIC
        :rtype: str
        :returns: a short usage string for the top of --help TOPIC)
        �nginxzH--nginx           Use the Nginx plugin for authentication & installationz+(the certbot nginx plugin is not installed)�apachezI--apache          Use the Apache plugin for authentication & installationz,(the certbot apache plugin is not installed)Trr5rCN)rrPrrrM�exitrSr�rWrZrr)rer rY�	nginx_doc�
apache_docrC�customs       rkr[z#HelpfulArgumentParser._usage_string�s���g��b�I�E�I��w��d�J�G�J����t���K�K�� 0�J�	�3J� J�J�Mc�c�d��H�H�Q�K�����-�-�
-��K�K��� 6� 6� 8�8�9��H�H�Q�K�����
�
�%��Y�(?�?�?�E�����#�
&�"�&�&�x��4�8�8��$�G�F�$�F�%�E��rm�configc��|j�J�|jdtjk(r|jdk(rg|_yyy)z8Make "certbot renew" safe if domains are set in cli.ini.N�domainsr,)�argument_sourcesr�CONFIG_FILEr�r��rer�s  rk�&remove_config_file_domains_for_renewalz<HelpfulArgumentParser.remove_config_file_domains_for_renewal�sM���&�&�2�2�2��#�#�I�.�.�2L�2L�L��	�	�W�$��F�N�%�
Mrmc�����jD�cic]}|jtj��c}��jj�}dttttjtffdtddf��fd�}|D].}|jd�s�|||tj��0||jdi�tj�d|vr�|d}|d\}}g}|D]�}	|	jd	�s�|	d
vrtj�d<�-d|	vr|	j!d�d
}	nd|	vr|	j!d�d
}	|	jd�r|j#|	���|	ddD]}
|j#d	|
������|D]0}	�j%|	�}tj�|j<�2�Scc}w)N�
settings_dict�sourcer!c����|j�D���cgc]\}\}}|��j|�n|��}}}}�j|D�cic]}|j|��c}�ycc}}}wcc}wru)�items�_find_action_for_arg�update�dest)r�r��arg�action�_rQ�resultres      ��rk�
update_resultz@HelpfulArgumentParser._build_sources_dict.<locals>.update_result�sz���0=�/B�/B�/D�F�F�+�3����:@��t�0�0��5�V�S�F�G�F��M�M�g�G�F�F�K�K��/�G�H��F��Gs�"A'�A.�config_file�env_var�command_liner{�-)r?r@�
config_dir�=r� �--�)rQr�r�DEFAULTrc�get_source_to_settings_dictrrZrr_�Action�
startswithr�r�ENV_VAR�COMMAND_LINE�split�appendr�)rer��source_to_settings_dictr��
source_keyr�r��unprocessed_argsrr��	short_argr�s`          @rk�_build_sources_dictz)HelpfulArgumentParser._build_sources_dict�s����FJ�\�\�S�6�6�;�;�� 6� 6�6�S��#'�+�+�"I�"I�"K��	I��c�5��9N�9N�PS�9S�3T�.T�)U�	I�"0�	I�59�	I�2�	_�J��$�$�]�3��5�j�A�>�C]�C]�^�	_�	�-�1�1�)�R�@�.�BX�BX�Y��4�4�3�N�C�M�$1�"�$5�!�Q� ��D�'�
5���~�~�c�*���,�,�+9�+F�+F�F�<�(���#�:��)�)�C�.��+�C��C�Z��)�)�C�.��+�C��>�>�$�'��K�K��$�&)���W�5�	����a�	�{�O�4�5�)
5�.�
B���2�2�3�7��&4�&A�&A��v�{�{�#�
B�
�
��yTs�"Gr�c���|ddk7rd|z}|jD]}||jvs�|cS|jD]*}|jD]}|j|�s�|ccS�,td|�d���)Nrr�r�z!Action corresponding to argument z is None)rQ�option_stringsr��AssertionError)rer�r��
option_strings    rkr�z*HelpfulArgumentParser._find_action_for_arg�s����q�6�S�=���*�C��l�l�	�F��f�+�+�+��
�	�
�l�l�	"�F�!'�!6�!6�
"�
� �+�+�C�0�!�M�
"�	"�
�@���X�N�O�Ormc���|jj|j�}|j|j|_|j|_t
|�}|j|j��|j|�|jdk(rE|jr2tjdjtj���d|_|jr>|j r2tjdjtj���|j"s|j$r|j'|�|j(r|j+|�|j,r|j.sd|_|j0rt3j0|�|j4r1t7d�|j8D��rtjd��|j:r!|j<rtjd��t?|j@tB�r-tE|j@�dkDrtjd	��|S)
z�Parses command line arguments and returns the result.

        :returns: parsed command line arguments
        :rtype: configuration.NamespaceConfig

        r,z{0} cannot be used with renewTz.Flag for non-interactive mode and {0} conflictc3�FK�|]}tj|����y�wru)r�is_wildcard_domain)rw�ds  rkryz3HelpfulArgumentParser.parse_args.<locals>.<genexpr>1s����F�!�4�*�*�1�-�F�s�!zFUsing --allow-subset-of-names with a wildcard domain is not supported.z@Parameters --hsts and --auto-hsts cannot be used simultaneously.r�z8Only *one* --key-type type may be provided at this time.)#rc�
parse_argsrrJr��funcr�set_argument_sourcesr�r��force_interactiver�Errorrar
�FORCE_INTERACTIVE_FLAG�noninteractive_mode�staging�dry_run�set_test_server�csr�
handle_csr�must_staple�staple�validate_hooksr�allow_subset_of_names�anyr��hsts�	auto_hstsrW�key_typerRrv)re�parsed_argsr�s   rkr�z HelpfulArgumentParser.parse_argss����k�k�,�,�T�Y�Y�7���:�:�d�i�i�0����9�9��� ��-���#�#�D�$<�$<�$>�?��3�3�F�;��9�9����'�'��l�l�3�:�:�!�8�8�:�;�;�*.�F�&��#�#��(B�(B��,�,�@�G�G��4�4�6�7�
7��>�>�V�^�^�� � ��(��:�:��O�O�F�#����f�m�m� �F�M�� � �� � ��(��'�'��F�v�~�~�F�F��l�l�$H�I�I��;�;�6�+�+��,�,�R�T�
T��f�o�o�t�,��V�_�_�1E��1I��,�,�J�L�
L��
rmc�.�t|j|�S)z�Updates server, break_my_certs, staging, tos, and
        register_unsafely_without_email in config as necessary to prepare
        to use the test server.)rr�r�s  rkr�z%HelpfulArgumentParser.set_test_server?s��'�t�y�y�&�9�9rmc�j�|jdk7rtjd��|jrtjd��|jdd\}}tj||�\}}}|D]}t||��|s%tjd|jdz��||f|_|D�chc]}|j���}	}t|j�}
|	|
k7rCtjdjdj|	�dj|
����y	cc}w)
zProcess a --csr flag.r%z�Currently, a CSR file may only be specified when obtaining a new or replacement via the certonly command. Please try the certonly command instead.z1--allow-subset-of-names cannot be used with --csrr�zJUnfortunately, your CSR %s needs to have a SubjectAltName for every domainzMInconsistent domain requests:
From the CSR: {0}
From command line/config: {1}z, N)r�rr�r�r�r
�import_csr_filer�
actual_csr�lower�setr��ConfigurationErrorrarb)rer��csrfile�contents�typr�r��domainr��csr_domains�config_domainss           rkr�z HelpfulArgumentParser.handle_csrEs-���;�;�*�$��,�,� ;�<�
<��'�'��,�,�R�S�S�"�J�J�q��O����'�7�7���J���S�'��	(�F����'�	(���,�,�\��*�*�Q�-� �!�
!�!�#�J���*1�2�Q�q�w�w�y�2��2��V�^�^�,���.�(��+�+�a����	�	�+�.��	�	�.�0I�J�L�
L�)��3s�9D0c��d|jvsd|jvrd|_yt|j�D]G\}}||jvs�|}|dk(rd}|dk(rd}||_|jj	|�yd|_y)	z�Determines the verb/subcommand provided by the user.

        This function works around some of the limitations of argparse.

        r=r<r;Nr$r%r/r&)rr��	enumeraterJ�pop)re�i�tokenr�s    rkrUz$HelpfulArgumentParser.determine_verbgs����4�9�9���D�I�I� 5��D�I��!�$�)�)�,�		�H�A�u���
�
�"����6�>�%�D��<�'� �D� ��	��	�	�
�
�a� ��		���	rm�flag�possible_argumentsc��||jvry|jj|�}	|j|dz}||vr|S	y#t$rYywxYw)asChecks cli input for flags.

        Check for a flag, which accepts a fixed set of possible arguments, in
        the command line; we will use this information to configure argparse's
        help correctly.  Return the flag's argument, if it has one that matches
        the sequence @possible_arguments; otherwise return whether the flag is
        present.

        Fr�T)r�index�
IndexError)rer�r��pos�nxts     rkrVz&HelpfulArgumentParser.prescan_for_flagsk���t�y�y� ���i�i�o�o�d�#��	��)�)�C�!�G�$�C��(�(��
�)����	���	�s�A�	A�A�topics�kwargsc�b�|jj|j|g|��i|���y)a1Add a new command line argument.

        :param topics: str or [str] help topic(s) this should be listed under,
                       or None for options that don't fit under a specific
                       topic which will only be shown in "--help all" output.
                       The first entry determines where the flag lives in the
                       "--help all" output (None -> "optional arguments").
        :param list *args: the names of this argument flag
        :param dict **kwargs: various argparse settings for this argument

        N)rQr��_add)rer�rr�s    rk�addzHelpfulArgumentParser.add�s+��	
�����I�D�I�I�f�>�t�>�v�>�?rmc��|jd�}|tjur|jj|i|��St|t�r |j|vr|jn|d}n|}t|t�sZ|j|rK||jvr!|j|}|j|i|��S|jj|i|��Stj|d<|jj|i|��S)Nr�rr;)
rr�DeprecatedArgumentActionrc�add_argumentrWrRrYrXr]r^�argparse�SUPPRESS)rer�rr�r��topic�groups       rkr�zHelpfulArgumentParser._add�s������H�%���T�2�2�2�,�4�;�;�+�+�T�<�V�<�<��f�d�#�&*�]�]�f�%<�D�M�M�&��)�E��E��%��&�4�+>�+>�u�+E�����#����E�*��)�u�)�)�4�:�6�:�:�/�t�{�{�/�/��@��@�@�%�.�.�F�6�N�+�4�;�;�+�+�T�<�V�<�<rm�
argument_name�num_argsc�r�tj|jd�}tj|||�y)a�Adds a deprecated argument with the name argument_name.

        Deprecated arguments are not shown in the help. If they are used
        on the command line, a warning is shown stating that the
        argument is deprecated and no other action is taken.

        :param str argument_name: Name of deprecated argument.
        :param int num_args: Number of arguments the option takes.

        N)�	functools�partialr�r�add_deprecated_argument)rer�r��add_funcs    rkr�z-HelpfulArgumentParser.add_deprecated_argument�s,��2�$�$�T�X�X�t�4���$�$�X�}�h�Grmr�rrc��|j|rg|jj|fi|��|j|<|jr1|D],}|j|j|t|d���.t||�S)a�Create a new argument group.

        This method must be called once for every topic, however, calls
        to this function are left next to the argument definitions for
        clarity.

        :param str topic: Name of the new argument group.
        :param str verbs: List of subcommands that should be documented as part of
                          this help group / topic

        :returns: The new argument group.
        :rtype: `HelpfulArgumentGroup`

        rz)r;)r]rc�add_argument_groupr^rYr�rr)rer�rrr�rxs     rk�	add_groupzHelpfulArgumentParser.add_group�s��� ���u�%�!?����!?�!?��!P��!P�D�K�K����}�}��W�A��K�K��&�3�3�A�M�!�<L�W�<U�3�V�W�#�D�%�0�0rmc��|j�D]>\}}|j||j��}|jj	||��@y)z�

        Let each of the plugins add its own command line arguments, which
        may or may not be displayed as help topics.

        )�descriptionN)r�r�long_description�
plugin_cls�inject_parser_options)rer �name�	plugin_ep�parser_or_groups     rk�add_plugin_argsz%HelpfulArgumentParser.add_plugin_args�sT�� '�}�}��	N�O�D�)�"�n�n�T�9B�9S�9S�-�U�O�� � �6�6���M�	Nrm�chosen_topicc��|dk(rd}|dk(rd}|dk(r|jD�cic]}||dk7��
c}S|s|jD�cic]}|d��c}S|jD�cic]}|||k(��
c}Scc}wcc}wcc}w)z�

        The user may have requested help on a topic, return a dict of which
        topics to display. @chosen_topic has prescan_for_flag's return type

        :returns: dict

        r$r%r/r&r5zcertbot-route53:authF)rT)rer
�ts   rkr\z+HelpfulArgumentParser.determine_help_topicss����6�!�%�L��<�'� �L��5� �<@�<L�<L�M�q�A�q�2�2�2�M�M��&*�&6�&6�7��A�u�H�7�7�.2�.>�.>�?���1��$�$�?�?��N��7��?s�
A-�
A2�
A7)r!N)�)&�__name__�
__module__�__qualname__�__doc__rrZrrlrSr�r	rXr[rr�rrr�r_r�r�r�r�r�rUrrVrr�r��intr�rrr�PluginsRegistryrr\rrmrkrr%s.���D�T�#�Y�D��#��D�4�D�NT�O�	�3�	�!�X�c�]�!�e�C��I�>N�!�SV�!�F �_� �QU� �B�T�#�~�*=�%>�B�HP��P��0E�0E�P�.6�O�6�p:�o�:�$�:�L��L�T�L�D�0�S��h�x�PS�}�>U��#�C��I�.��,
@�(�5��h�s�m�)<�c�)A�#B�C�
@�C�
@��
@�"�
@�=�8�E�$�x��}�*=�s�*B�$C�D�=�S�=��=�,�3�3�=�>H�S�H�C�H�D�H�81�s�1�8�C�=�1��1�$8�1�.
N�u�'<�'<�
N��
N�@�%��T�	�2B�@�#'���
�t�(;�#<�@rmr)*rr�r�rM�typingrrrrrrr	r_r>r
rrrHr
r�#certbot._internal.cli.cli_constantsrrr�certbot._internal.cli.cli_utilsrrrrr�certbot._internal.cli.verb_helprr�certbot._internal.displayrrK�certbot._internal.pluginsr�certbot.configurationrrrrrmrk�<module>rsp��*���
������������'�#�@�F�;�7�?�8�@�C�5�9�8�+�0�1�r@�r@rm

Zerion Mini Shell 1.0