> ## Documentation Index
> Fetch the complete documentation index at: https://timoni.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# timoni fmt

> Format CUE files

## Synopsis

The fmt command rewrites CUE files in the standard format.

Arguments are files or directories, defaulting to the current directory.
Directories are formatted recursively; during the walk, directories named
"cue.mod" and those with a "." or "\_" prefix are skipped unless given as
explicit arguments.

Files inside a module are parsed under the language version declared in
the module's cue.mod/module.cue, matching the behavior of Timoni's module
builds; files outside any module use the CUE version built into Timoni.

When run with `--diff`, no files are rewritten, the pending changes are
printed as unified diffs and the command fails if any file is not well
formatted.

```
timoni fmt [PATH ...] [flags]
```

## Examples

```sh theme={"system"}
  # Format the current directory recursively
  timoni fmt

  # Verify formatting and print a diff for each file that needs changes
  timoni fmt --diff

  # Show the changes formatting would make to a bundle
  timoni fmt --diff bundle.cue

  # Format standard input, for editor integration
  timoni fmt -

```

## Options

```
  -d, --diff   Print the diffs and exits 1 if any file needs formatting.
  -h, --help   help for fmt
```

## Options inherited from parent commands

```
      --cache-dir string                    Artifacts cache dir, can be disable with 'TIMONI_CACHING=false' env var. (defaults to "$HOME/.timoni/cache")
      --kube-as string                      Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
      --kube-as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --kube-as-uid string                  UID to impersonate for the operation.
      --kube-certificate-authority string   Path to a cert file for the certificate authority.
      --kube-client-certificate string      Path to a client certificate file for TLS.
      --kube-client-key string              Path to a client key file for TLS.
      --kube-context string                 The name of the kubeconfig context to use.
      --kube-insecure-skip-tls-verify       if true, the Kubernetes API server's certificate will not be checked for validity. This will make your HTTPS connections insecure.
      --kube-server string                  The address and port of the Kubernetes API server.
      --kube-tls-server-name string         Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used.
      --kube-token string                   Bearer token for authentication to the API server.
      --kubeconfig string                   Path to the kubeconfig file.
      --log-color                           Adds colorized output to the logs. (defaults to false when no tty)
      --log-pretty                          Adds timestamps to the logs. (default true)
  -n, --namespace string                    The the namespace scope for the operation. (default "default")
      --registry-insecure                   If true, allows connecting to a container registry without TLS or with a self-signed certificate.
      --timeout duration                    The length of time to wait before giving up on the current operation. (default 5m0s)
```

## See also

* [timoni](/cmd/timoni)	 - A package manager for Kubernetes powered by CUE.
