. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 162.0.212.4 / Your IP :
216.73.216.221 [
Web Server : LiteSpeed System : Linux premium146.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : alshnoli ( 2431) PHP Version : 8.3.28 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/cloudlinux/venv/lib64/python3.11/site-packages/__pycache__/ |
Upload File : |
�
b�i� � �8 � d Z ddlZdZdedefd�Zdded efd
�ZdS )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.
� NzAvailable values for option�data�returnc � � | � d� � r#| � dd� � \ }}d|z d|id�S | � t � � r5| � dd� � \ }}|dz 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 �param)�result�context�:z: %%(available_options)s�available_optionsr )�
startswith�split�
VALUES_STR�strip)r r �texts �py/cli_utils.py�replace_paramsr s� � � ���t��� M��j�j��a�(�(���t�'�$�.�G�U�;K�L�L�L����z�"�"� A��j�j��a�(�(���e��!;�;�/������?�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 '