> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-c8329da0.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Altere o prompt no clickhouse-client

> Este artigo explica como alterar o prompt no ClickHouse client e na janela do terminal do clickhouse-local de :) para um prefixo seguido de :)

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

Se você não gosta de como o `clickhouse client` e o clickhouse-local exibem o prompt no terminal, é possível alterá-lo para incluir um prefixo.
Este artigo explica como mudar o prompt para o que você quiser.

O prompt padrão é o nome do seu computador local seguido de `:) `:

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/0_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=54015ac605748286980d488a78d1de1d" size="md" alt="Prompt padrão do ClickHouse client" width="2289" height="411" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/0_prompt.png" />

Estas são as variáveis que você pode usar em um prompt: `{user}`, `{host}`

Há várias maneiras de alterar o prompt, e vamos passar por cada uma delas.

<div id="--prompt-flag">
  ## flag `--prompt`
</div>

A primeira forma de alterar a flag é com `--prompt`:

```bash theme={null}
clickhouse --prompt 👉
```

Isso adicionará o emoji de dedo antes da carinha sorridente:

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/1_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=50e65a00e6860dfc2beecebb4188d70a" size="md" alt="Prompt do ClickHouse client com emoji de dedo" width="2298" height="386" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/1_prompt.png" />

<div id="config-file---top-level">
  ## Arquivo de configuração - nível superior
</div>

Como alternativa, você pode fornecer um prefixo de prompt em um arquivo `config.xml`:

```xml theme={null}
<config>
    <prompt>👉 </prompt>
</config>
```

```
clickhouse
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/2_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=b1ad593664d6f4d5be75c16acdb2ff14" size="md" alt="Prompt do ClickHouse client com arquivo de configuração" width="2307" height="769" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/2_prompt.png" />

Podemos usar um arquivo de configuração com o nome que quisermos e passá-lo com a flag `-C`:

```xml theme={null}
<config>
    <prompt>🎄 </prompt>
</config>
```

```
clickhouse -C christmas.xml
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/3_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=cea2872a2057e433761def6b4f01045b" size="md" alt="prompt do ClickHouse client com emoji de árvore de Natal" width="2314" height="781" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/3_prompt.png" />

Prefere seus arquivos de config em YAML?
Isso também funciona:

```yaml theme={null}
prompt: 🟡
```

```bash theme={null}
clickhouse -C christmas.yaml
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/4_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=b33434bb908a85cf648ef6ebac97d5b2" size="md" alt="Prompt do ClickHouse client com emoji de círculo amarelo" width="2302" height="600" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/4_prompt.png" />

<div id="config-file---connections_credentials">
  ## Arquivo de configuração - connections\_credentials
</div>

Como alternativa, você pode especificar um prompt para cada credencial de conexão.
Isso só faz sentido ao usar o clickhouse-client.

```xml theme={null}
<config>
    <connections_credentials>
        <connection>
            <n>prod<n>
            <hostname>127.0.0.1</hostname>
            <port>9000</port>
            <secure>0</secure>
            <user>default</user>
            <prompt>\e[31m[PRODUCTION]\e[0m {user}@prod</prompt>
        </connection>
        <connection>
            <n>dev<n>
            <hostname>127.0.0.1</hostname>
            <port>9000</port>
            <secure>0</secure>
            <user>default</user>
            <prompt>\e[32m[DEVELOPMENT]\e[0m {user}@dev</prompt>
        </connection>
    </connections_credentials>
</config>
```

Podemos então tentar nos conectar usando a conexão `dev`:

```bash theme={null}
clickhouse client -C connections.xml --connection dev
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/5_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=654c16a55bdaa60bca62152cff4177b4" size="md" alt="Prompt do ClickHouse client com conexão de desenvolvimento" width="1310" height="203" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/5_prompt.png" />

Ou a `prod`:

```bash theme={null}
clickhouse client -C connections.xml --connection prod
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/6_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=8e2bc10b3f32d23c7705d8f19cbab041" size="md" alt="prompt do ClickHouse client com conexão de produção" width="1297" height="189" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/6_prompt.png" />

E aqui está a versão em YAML:

```yaml theme={null}
connections_credentials:
  connection:
    - name: prod
      hostname: 127.0.0.1
      port: 9000
      secure: 0
      user: default
      prompt: "\e[35m[PRODUCTION]\e[0m {user}@{host}"
    - name: dev
      hostname: 127.0.0.1
      port: 9000
      secure: 0
      user: default
      prompt: "\e[34m[DEVELOPMENT]\e[0m {user}@{host}"
```

Com a conexão `dev`:

```bash theme={null}
clickhouse client -C connections.yaml --connection dev
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/7_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=52dfdc5be172704207f4311517e261ef" size="md" alt="Prompt do ClickHouse client com conexão de desenvolvimento usando YAML" width="1581" height="169" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/7_prompt.png" />

E agora `prod`:

```bash theme={null}
clickhouse client -C connections.yaml --connection prod
```

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-c8329da0/NxwulvjKHxQwn5ny/images/knowledgebase/change-the-prompt-in-clickhouse-client/8_prompt.png?fit=max&auto=format&n=NxwulvjKHxQwn5ny&q=85&s=2d9bc622f9cdee279a012a92d8f85b9f" size="md" alt="prompt do ClickHouse client com conexão de produção usando YAML" width="1525" height="187" data-path="images/knowledgebase/change-the-prompt-in-clickhouse-client/8_prompt.png" />
