Manage blog posts from the terminal: list, get, search, create, edit, publish, delete, and export. Includes CLI-only backdating and image uploads.

## Posts

### list

```bash
floggy posts list
floggy posts list --status draft --limit 10
floggy posts list --json
```

```
ID            STATUS     PUBLISHED   TITLE
6N5VcqPdwU41i…published  2026-04-02  Another test post  /another-test-post
```

### get

```bash
floggy posts get <id|slug>
floggy posts get my-slug --json
```

### search

Searches your posts by title and content, including drafts.

```bash
floggy posts search "blockchain" --limit 10
floggy posts search "blockchain" --json | jq '.[].slug'
```

### create

```bash
floggy posts create --title "Hello world" --file post.md --status published
echo "# hi" | floggy posts create --title "Quick" --stdin --status draft
floggy posts create --title "Raw" --json content.json   # skip markdown conversion
```

Flags: `--title` (required), `--slug`, `--file`, `--stdin`, `--json <path>`, `--status draft|published`, `--published-at <iso>`, `--tags a,b,c`, `--visibility public|unlisted|private`, `--excerpt`.

Backdating works only via the CLI. `--published-at 2024-03-01T10:00:00Z` is preserved through publish.

### edit

```bash
floggy posts edit <id> --title "New title" --file updated.md
floggy posts edit <id> --tags "rust,systems"
```

Same flags as create, all optional. Pass `--tags ""` to clear tags.

### publish

```bash
floggy posts publish <id>
floggy posts publish <id> --at 2024-01-15T09:00:00Z
```

Backdating gotcha: Floggy sets the publish date to now on first publish. The CLI preserves a backdated draft's date by re-sending it, so a backdated draft keeps its date when published. To override explicitly, pass `--at`.

### delete

```bash
floggy posts delete <id>
```

### export

```bash
floggy posts export ./out
floggy posts export ./out --status published
```

Writes one `<slug>.md` per post into `./out` with YAML frontmatter (`title`, `slug`, `status`, `publishedAt`, `tags`, `excerpt`) and a markdown body converted from the Tiptap JSON. See [Recipes](/docs/cli/recipes) for markdown conversion notes and limits.

## Upload

```bash
floggy upload pic.png                 # URL printed to stdout, info to stderr
floggy upload pic.png --folder posts
floggy upload pic.png --json          # full JSON (key + url)
URL=$(floggy upload pic.png)
echo "![alt]($URL)"
```

Allowed: `image/jpeg`, `image/png`, `image/gif`, `image/webp`. PDFs allowed when `--folder cv`. Max 10 MB.
