File: //lib/python3/dist-packages/awscli/customizations/configure/__pycache__/get.cpython-310.pyc
o
.&�a� � @ sR d dl Z d dlZd dlmZ d dlmZ ddlmZ e�e �Z
G dd� de�ZdS )� N)�BasicCommand)�six� )�PREDEFINED_SECTION_NAMESc sl e Zd ZdZe�ddd�ZdZe�ddd�Zdddd d
d�gZ e
je
jf� fdd
� Z
dd� Zdd� Z� ZS )�ConfigureGetCommand�get� configurez_description.rstz2aws configure get varname [--profile profile-name]z
_examples.rst�varnamez)The name of the config value to retrieve.�store�stringT)�name� help_text�action�
cli_type_name�positional_argc s t t| ��|� || _|| _d S )N)�superr �__init__�_stream�
_error_stream)�self�session�stream�error_stream�� __class__� �E/usr/lib/python3/dist-packages/awscli/customizations/configure/get.pyr % s
zConfigureGetCommand.__init__c C s� |j }d|vr| j�� }|�|�}n| �|�}t�d| � t|tj �r2| j
�|� | j
�d� dS t|t�rA| j
�d| � dS dS )N�.zConfig value retrieved: %s�
r zBvarname (%s) must reference a value, not a section or sub-section.r )r �_session�get_scoped_configr �_get_dotted_config_value�LOG�debug�
isinstancer �string_typesr �write�dictr )r �args�parsed_globalsr �config�valuer r r � _run_main* s$
��zConfigureGetCommand._run_mainc
C s^ |� d�}|�d�}|dkr9|d tv r9| jj}|� d�\}}|�|i ��|�}|d u r7|d �|i ��|�}|S |d dkrN|d }|d }|dd � } n5|d dks^|d | jjd v rm|d }|d }|dd � } n| j�d�}|d u ryd}|d }|dd � } | jjd �|i ��|�}t| �dkr�z
|�| d �}W |S ty� d }Y |S w |S )
Nr r r �profiles�profile� � �default���) �split�countr r �full_configr �get_config_variable�len�AttributeError)
r r �parts�num_dotsr5 �section�config_namer+ �profile_name� remainingr r r r! F sR
������z,ConfigureGetCommand._get_dotted_config_value)�__name__�
__module__�__qualname__�NAMEr � FROM_FILE�DESCRIPTION�SYNOPSIS�EXAMPLES� ARG_TABLE�sys�stdout�stderrr r, r! �
__classcell__r r r r r s ���r )rH �logging�awscli.customizations.commandsr �
awscli.compatr � r � getLoggerr? r"