File: //opt/cloudlinux/venv/lib/python3.11/site-packages/__pycache__/cli_utils.cpython-311.pyc
�
�ʘf� � �P � d Z ddlmZ ddlmZ ddlZdZdedefd�Zd
d
e de fd�Z
dS )z�
This module serves as a collection of functions needed by various
cloudlinux-* utilities. It should not include any functions specific to a one
single utility as to not pollute it with unnecessary imports.
� )�print_function)�absolute_importNzAvailable values for option�data�returnc � � | � d� � r#| � dd� � \ }}d|z d|id�S | � t � � r5| � dd� � \ }}d|z d |� � � id�S d
| iS )z�
Replacing params in a data string to display an error message for humans.
:param data: error's data for show message
:return: a dictionary suitable for UI
z--� � z
%%(param)s %s�param)�result�context�:z%s: %%(available_options)s�available_optionsr )�
startswith�split�
VALUES_STR�strip)r r
�texts �py/cli_utils.py�replace_paramsr s� � � ���t��� O��j�j��a�(�(���t�)�D�0�g�u�=M�N�N�N����z�"�"� A��j�j��a�(�(���e�6��=�/������?�A� A� A��d��� F�is_json� is_prettyc �� � |rM|r&t t j | dd�� � � � dS t t j | d�� � � � dS t | � � dS )z�
Print specified dictionary
:param data_dict: data dictionary to print
:param is_json: True - print in JSON, False - in text
:param is_pretty: True - pretty json print, False - none (default)
:return: None
� T)�indent� sort_keys)r N)�print�json�dumps)� data_dictr r s r �print_dictionaryr! ( sr � � � �� 9��$�*�Y�q�D�A�A�A�B�B�B�B�B��$�*�Y�$�7�7�7�8�8�8�8�8� �i�����r )FF)�__doc__�
__future__r r r r �str�dictr �boolr! � r r �<module>r( s� ��� �
&� %� %� %� %� %� &� &� &� &� &� &� ���� +�
��� �� � � � �"� �� �$� � � � � � r