# pan file — File Browser

Opens an interactive file browser popup to select a file.

## Usage

```
pan file [OPTIONS] [PATH]
```

## Arguments

| Argument | Default       | Description                        |
|----------|---------------|------------------------------------|
| `PATH`   | Current dir   | Starting directory                 |

## Options

| Flag                     | Default              | Description                        |
|--------------------------|----------------------|------------------------------------|
| `-d`, `--dirs`           | (off)                | Select directories mode            |
| `-m`, `--multi`          | (off)                | Enable multi-select with Space     |
| `-M`, `--max`            | (unlimited)          | Max selected items                 |
| `-W`, `--width`          | `0` (auto)           | Popup width                        |
| `--guide`                |                      | Show this guide                    |

## Selection behavior

| Modo | Enter | Space | `o` en directorio |
|---|---|---|---|
| (sin flags) | archivo → selecciona, directorio → entra | — | Entra al directorio |
| `--dirs` | Selecciona directorio actual (cwd) | Selecciona el directorio y termina | Entra al directorio |
| `--multi` | Confirma los toggled | Toggle archivos | Entra al directorio |
| `--multi --dirs` | Confirma los toggled | Toggle directorios | Entra al directorio |

## Exit codes

| Code | Meaning                     |
|------|-----------------------------|
| 0    | File(s) selected (path on stdout) |
| 1    | Cancelled / invalid selection  |

## Examples

```bash
# Browse from current directory
pan file

# Select a file from a specific path
pan file /home/user/Documents

# Select current directory (Enter) or a subdirectory (Space)
pan file -d

# Multi-select files
pan file -m
```

## Keys

| Key              | Action                        |
|------------------|-------------------------------|
| `↑` / `k`        | Navigate up                   |
| `↓` / `j`        | Navigate down                 |
| `g` `g`          | Go to first item              |
| `G`              | Go to last item               |
| `o`              | Enter directory               |
| `Space`          | Select dir (dirs) / Toggle files (multi) / Toggle dirs (multi --dirs) |
| `Enter`          | Select / confirm              |
| `←` / `Backspace`| Go to parent directory        |
| `/`              | Filter list                   |
| `Esc`            | Exit / close filter           |
| `Ctrl` + `c`     | Emergency exit                |
