Metadata-Version: 2.4
Name: cftui
Version: 0.1.0
Summary: Manage Cloudflare DNS records from your terminal.
Project-URL: Homepage, https://github.com/Marshmellond/cftui
Project-URL: Repository, https://github.com/Marshmellond/cftui
Project-URL: Issues, https://github.com/Marshmellond/cftui/issues
License: MIT
License-File: LICENSE
Keywords: cli,cloudflare,dns,terminal,tui
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: Name Service (DNS)
Requires-Python: >=3.11
Requires-Dist: cloudflare>=2.0.0
Requires-Dist: platformdirs>=4.0.0
Requires-Dist: textual>=0.80.0
Description-Content-Type: text/markdown

# cftui

<p align="center">
  <b>Manage Cloudflare DNS records from your terminal.</b>
</p>

<p align="center">
  <a href="https://pypi.org/project/cftui/"><img src="https://img.shields.io/pypi/v/cftui?color=orange" alt="PyPI"></a>
  <a href="https://pypi.org/project/cftui/"><img src="https://img.shields.io/pypi/pyversions/cftui" alt="Python"></a>
  <a href="https://github.com/Marshmellond/cftui/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Marshmellond/cftui" alt="License"></a>
</p>

---

**cftui** = **C**loud**f**lare **TUI**

- **GitHub** &nbsp;→&nbsp; [github.com/Marshmellond/cftui](https://github.com/Marshmellond/cftui)
- **PyPI** &nbsp;&nbsp;&nbsp;→&nbsp; [pypi.org/project/cftui](https://pypi.org/project/cftui/)

[中文文档](docs/README_zh.md)

![screenshot](docs/example.webp)

## Features

- Browse, add, edit, and delete DNS records
- Supports **A**, **AAAA**, **CNAME**, **MX**, **TXT**, **NS**, **SRV**, **CAA** record types
- Toggle Cloudflare proxy (orange cloud) on/off
- Built-in settings screen — no manual config file editing required
- Cross-platform: Windows, macOS, Linux
- Configurable via environment variables or TOML file

## Installation

### pipx

```bash
pipx install cftui
```

### uv

```bash
uv tool install cftui
```

### pip

```bash
pip install cftui
```

### Run without installing

```bash
uvx cftui
```

## Usage

```bash
cftui
```

### Key bindings

| Key                 | Action                 |
| ------------------- | ---------------------- |
| `Ctrl+S`            | Open settings          |
| `Ctrl+R`            | Refresh records        |
| `a`                 | Add a new record       |
| `Enter`             | Edit selected record   |
| `d`                 | Delete selected record |
| `Ctrl+C` / `Ctrl+Q` | Quit                   |

## Configuration

On first launch, `cftui` creates a config file at:

| Platform | Path                                              |
| -------- | ------------------------------------------------- |
| Windows  | `%APPDATA%\cftui\config.toml`                     |
| macOS    | `~/Library/Application Support/cftui/config.toml` |
| Linux    | `~/.config/cftui/config.toml`                     |

You can configure everything from the built-in settings screen (`Ctrl+S`), or edit the file manually.

### config.toml

```toml
# Cloudflare API Token
# Create at: https://dash.cloudflare.com/profile/api-tokens
# Permission: Zone · DNS · Edit
api_token = "your_token_here"

# Zone identifier (choose ONE)
zone_name = "example.com"
zone_id = ""
```

### Environment Variables

All config values can also be set via environment variables:

| Variable        | Equivalent  |
| --------------- | ----------- |
| `CFD_API_TOKEN` | `api_token` |
| `CFD_ZONE_NAME` | `zone_name` |
| `CFD_ZONE_ID`   | `zone_id`   |

### API Token

Create a Cloudflare API token at [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens).

Required permission: **Zone · DNS · Edit**

### Zone

Pick one:

- **Zone Name** — your domain, e.g. `example.com`
- **Zone ID** — found on the Cloudflare dashboard overview page

## Development

```bash
git clone https://github.com/Marshmellond/cftui.git
cd cftui
uv sync
uv run cftui
```

Python 3.11+ required.

## License

[MIT](LICENSE)
