@flaredlink/cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +661 -0
- package/README.md +54 -2
- package/dist/flared.js +896 -0
- package/package.json +26 -5
package/README.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @flaredlink/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Create, edit, and measure [Flared](https://flared.page) short links from your terminal. The installed command is `flared`. It needs Node.js 20 or later.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @flaredlink/cli
|
|
7
|
+
flared login
|
|
8
|
+
flared link create https://example.com/launch --slug launch
|
|
9
|
+
flared analytics launch
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Create an API token in the Flared app under Settings. `flared login` asks for it without showing it, checks it with the API, and saves it in `~/.config/flared/config.json` (or `$XDG_CONFIG_HOME/flared`; `%APPDATA%\flared` on Windows), readable only by you. In CI, set `FLARED_TOKEN` instead, or pipe the token to `flared login --token-stdin`.
|
|
13
|
+
|
|
14
|
+
## Commands
|
|
15
|
+
|
|
16
|
+
| Command | What it does |
|
|
17
|
+
| -------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
18
|
+
| `flared login [--token-stdin]` | Save an API token after the API accepts it. |
|
|
19
|
+
| `flared logout` | Delete the saved token. Revoke it in Settings to stop it working. |
|
|
20
|
+
| `flared whoami` | Show the token, its scopes, and the API URL. |
|
|
21
|
+
| `flared link create URL [--slug S] [--title T] [--idempotency-key K]` | Create a link and print its short URL. Reuse a key to retry safely. |
|
|
22
|
+
| `flared link list [--search Q] [--limit N] [--cursor C] [--all]` | List links, newest first. |
|
|
23
|
+
| `flared link get LINK` | Show one link. |
|
|
24
|
+
| `flared link update LINK [--destination URL] [--title T \| --clear-title]` | Change the destination or the title. |
|
|
25
|
+
| `flared link disable LINK`, `flared link enable LINK` | Stop or restart redirects. A disabled link keeps its slug. |
|
|
26
|
+
| `flared link qr LINK [--format svg\|png] [--out FILE]` | Make a QR code. SVG goes to standard output without `--out`. |
|
|
27
|
+
| `flared analytics LINK [--from YYYY-MM-DD] [--to YYYY-MM-DD]` | Clicks by day, country, referrer, and device. |
|
|
28
|
+
| `flared usage` | Recorded clicks this month and the allowance. |
|
|
29
|
+
|
|
30
|
+
`LINK` is a link ID or a slug. Every command accepts `--json` for machine-readable output and `--api-url URL`.
|
|
31
|
+
|
|
32
|
+
## Self-hosted Flared
|
|
33
|
+
|
|
34
|
+
Point the CLI at your instance's API with `--api-url` or `FLARED_API_URL`, for example `https://links.example.com/v1`. `flared login --api-url URL` saves it with the token. HTTPS is required except on `localhost`.
|
|
35
|
+
|
|
36
|
+
## Exit codes
|
|
37
|
+
|
|
38
|
+
| Code | Meaning |
|
|
39
|
+
| ---- | ----------------------------------------------------------- |
|
|
40
|
+
| 0 | Success |
|
|
41
|
+
| 1 | Unexpected failure |
|
|
42
|
+
| 2 | Wrong command usage |
|
|
43
|
+
| 3 | Not signed in, or the token is invalid, expired, or revoked |
|
|
44
|
+
| 4 | Not allowed, for example a missing scope |
|
|
45
|
+
| 5 | Not found |
|
|
46
|
+
| 6 | Rejected input or a conflict, such as a slug in use |
|
|
47
|
+
| 7 | Plan limit reached |
|
|
48
|
+
| 8 | Rate limited |
|
|
49
|
+
| 9 | Service unavailable or no network |
|
|
50
|
+
|
|
51
|
+
With `--json`, errors go to standard error as `{ "error": { "code", "message", "requestId" } }`.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
AGPL-3.0-only. The source is in [FlaredLink/Flared](https://github.com/FlaredLink/Flared/tree/main/packages/cli).
|