# CLI

`goff` has been the client command since version 0.8.0. `goff --help` lists the subcommands. `goff --version` prints the crate version.

Client keys live in the server config, not in the CLI. `--host` and `--api-key` are on each subcommand that talks to the server. They can also come from `GEOFFREY_HOST` and `GEOFFREY_API_KEY`. At startup the CLI loads a gitignored `.env` from the current directory or a parent directory. It does not override variables already in the process environment. Precedence is flag, then process environment, then `.env`. A missing `.env` is ignored. A `.env` that cannot be parsed is an error. That overlay has been available since version 0.6.0.

```bash
# .env
GEOFFREY_HOST=http://localhost:3000
GEOFFREY_API_KEY=replace-me

goff list
```

## Commands

| Command | Role |
|---|---|
| `goff create --duration 3600 FILE...` | Create a rental, upload the files, and enable it. |
| `goff new` | Create and upload, and leave the rental inactive. |
| `goff upload --rental-id ID FILE...` | Add or overwrite files on a rental that already exists. |
| `goff enable ID` | Start the lease. Only an `inactive` rental enables. |
| `goff disable ID` | Return an active rental to `inactive` and clear the lease. |
| `goff revive ID --add-day` | Extend an active or expired rental. Also `--add-hour`, `--add-week`, `--add-month`, and `--add-minutes NUM`. |
| `goff lock ID` / `goff unlock ID` | Hold expiry, or drop the hold. Unlock does not add time. |
| `goff get ID` | Print one rental. |
| `goff list` | Table of this key's rentals. `--json` prints the API envelope, including `upload_token`. |
| `goff info` | This key's allowance and bytes stored, the host totals, and the room left to upload. `--json` prints integer byte counts. Sizes are 1024-based. |
| `goff purge ID` | Delete one unlocked `inactive` or `expired` rental. |
| `goff purge --expired` | Delete every rental this key lists as `expired`. |
| `goff watch` | Publish each new screenshot. See [screenshot watch](/features/watch/). |

`--duration` defaults to 3600 seconds. `--locked` on `create` and `new` holds the rental from the start.

A directory argument publishes the files inside it. `./site` stores `site/index.html` as `index.html` and `site/css/app.css` as `css/app.css`. Names that start with `.` and directories named `target` are left out of that walk. A file argument is stored under its final path segment, so `docs/notes.txt` is stored as `notes.txt`. Directory upload has been available since version 0.9.0.

`goff purge ID` and `goff purge --expired` cannot be combined. Passing both, or passing neither, is a usage error and sends no request. `purge --expired` prints `Purged {id}` for each rental, then how many rentals were deleted and how many bytes that freed. Inactive and locked rentals stay, including a locked rental whose lease is already past.

`list` columns are `rental_id`, `status`, `expires_at`, stored bytes, and `base_file_url`. Stored bytes have been on that table since version 0.10.0.

The [changelog](/changelog/) records when the command name, directory upload, and watch command appeared.

