# Command - User

Manage user credentials for connecting to the message broker protocol

Usage: `foxmq user <COMMAND>`

### Subcommands

<table><thead><tr><th width="172">Command</th><th width="393">Description</th><th>Quick-link</th></tr></thead><tbody><tr><td><code>add</code></td><td>Add a user record to the credentials file, creating it if it doesn't exist.</td><td><a data-mention href="#add">#add</a></td></tr><tr><td><code>generate</code></td><td>Generate a user record and print it to stdout</td><td>#generate</td></tr></tbody></table>

### `add`

Add a user record to the credentials file, creating it if it doesn't exist.

If a username and/or password are not provided, you will be prompted for them interactively.

Usage: `foxmq user add [OPTIONS] [USERNAME] [PASSWORD]`

#### Arguments

* `USERNAME`\
  The username of the user. Must be unique within the users file.\
  \
  If omitted, you will be prompted to enter it interactively.
* `PASSWORD`\
  The password for the user.\
  \
  If omitted, you will be prompted to enter it interactively, or be given the option to generate a random one.

#### Options

* `--log`, `-l`\
  Set the format of log output.
  * Default: `full`
  * Options: `full`, `compact`, `pretty`, `json`
    * `json` is structured and is intended for usage by tools that process structured logs in production environments, and is not optimized for human readability.
* `--output-file`, `-O`\
  The path to write the address book and secret key files to.\
  \
  If any parent directories in the path do not already exist, they will be created.<br>
  * Default: `foxmq.d/users.toml`
* `--write-mode`, `-m`\
  Controls how this command writes to `--output-file`.
  * Default: `append`
  * Possible values:
    * `append`: Append to the file if it already exists, or create it if it doesn't.
    * `truncate`: Truncate the file if it already exists, or create it if it doesn't.

### `generate`

Generate a user record and write it to `stdout`

Usage: `foxmq user generate [OPTIONS] <USERNAME> [PASSWORD]`

#### Arguments

* `USERNAME`

  The username of the user. Must be unique within the users file.
* `PASSWORD` \
  The password for the user.\
  \
  If omitted, the password will be read from the first line on `stdin`.

#### Options

`--log`, `-l`\
Set the format of log output.

* Default: `full`
* Options: `full`, `compact`, `pretty`, `json`
  * `json` is structured and is intended for usage by tools that process structured logs in production environments, and is not optimized for human readability.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tashi.network/resources/foxmq/cli-options/command-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
