binks-cli (0.7.2)

Published 2026-04-08 15:43:40 -05:00 by miles in miles/binks-cli

Installation

[registries.forgejo]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add binks-cli@0.7.2 --registry forgejo

About this package

Binks CLI

A command-line interface for the Binks pastebin service that supports text pastes, file uploads, password protection, and end-to-end encrypted mode.

Installation

cargo build --release

Examples

# Paste from stdin
echo "Hello, World!" | binks

# Paste from file
cat myfile.txt | binks

# Paste with expiration
echo "Temporary paste" | binks --expiration 1h

# Password-protected paste
binks paste --content "My secret" --password

# End-to-end encrypted paste (prints URL with #k=<key>)
binks paste --content "Client-side secret" --encrypted

# Encrypted paste via bare pipe (no subcommand)
echo "secret" | binks --encrypted

# Copy URL to clipboard automatically
echo "Hello" | binks --copy

# Script-friendly: print only the URL
echo "Hello" | binks --quiet

# Print version
binks --version

File Upload

# Upload a single file
binks upload path/to/file.txt

# Upload with custom settings (note: options go before the command)
binks --expiration 1d --password secret upload file.txt

# Upload and copy URL to clipboard
binks --copy upload image.png

# End-to-end encrypted upload
binks upload ./archive.zip --encrypted

Retrieving Pastes and Files

# Get a paste - shows content for text, shows content + downloads file for uploads
# Also falls back to the file endpoint automatically for file-only uploads
binks get PASTE_ID

# Get with password
binks get PASTE_ID --password mypassword

# Get encrypted paste (key can be passed directly or included as URL fragment)
binks get PASTE_ID --key BASE64URL_KEY
binks get "https://binks.example/PASTE_ID#k=BASE64URL_KEY"

# Save text content to file or download file with custom name
binks get PASTE_ID --output myfile.txt

# Fetch raw text content (no metadata parsing)
binks get PASTE_ID --raw

# Show detailed metadata instead of content/downloading
binks get PASTE_ID --info

# Show metadata as JSON for scripting
binks get PASTE_ID --info --json

# Copy file path to clipboard after download
binks get PASTE_ID --copy

Configuration

# Shorten a URL
binks shorten https://example.com/very/long/path

# Shorten with custom ID and expiration
binks shorten https://example.com --id myalias --expiration 1d

# Shorten with burn-after (link expires after N accesses)
binks shorten https://example.com --burn-after 1

Configuration

# Set BINKS_URL environment variable
export BINKS_URL=https://your-binks-server.com

# Or persist it in the config file
binks config set api_url https://your-binks-server.com

# Self-signed / custom CA cert (development)
binks --ca-cert /path/to/ca.pem paste --content "hello"
binks --insecure paste --content "hello"

Options

Global Options

  • --api-url: Set the API URL (overrides config; BINKS_URL env var also accepted)
  • --expiration: Set expiration time (never, 1h, 1d, 1w, 1m, 1y)
  • --burn-after: Number of reads before burning the paste
  • --copy / -c: Copy URL to clipboard after creation
  • --json: Output results as JSON for scripting
  • --quiet / -q: Print only the final URL (suppresses status messages)
  • --encrypted: End-to-end encrypt when piping without a subcommand
  • --key KEY: Provide an explicit encryption key for --encrypted (base64url)
  • --password PASSWORD: Password-protect when piping without a subcommand
  • --url / -u: Custom short ID / URL override
  • --insecure: Accept invalid TLS certificates (DANGEROUS — dev only)
  • --ca-cert PATH: Trust a custom PEM CA certificate bundle
  • --version: Print version and exit

Commands

paste

Create a new text paste

  • --content: Content to paste (reads from stdin if not provided)
  • --file: File to attach to the paste
  • --id: Custom ID for the paste
  • --password [PASSWORD]: Password protect the paste (prompt if omitted)
  • --encrypted: Encrypt paste content and attached file locally (conflicts with --password)
  • --key KEY: Explicit encryption key for --encrypted (otherwise auto-generated)

upload

Upload a file directly (from file path or stdin)

  • path: Path to the file to upload (optional, reads from stdin if not provided)
  • --id: Custom ID for the file
  • --name: Filename to use when uploading from stdin
  • --password [PASSWORD]: Password protect upload (prompt if omitted)
  • --encrypted: Encrypt upload locally (conflicts with --password)
  • --key KEY: Explicit encryption key for --encrypted (otherwise auto-generated)

get

Retrieve a paste or file by ID (shows content for text, shows content + downloads files for uploads; falls back to /api/file/{id} automatically when the paste endpoint returns 404)

  • id: Paste/file ID to retrieve
  • --output: Save content to file or use custom filename for downloads
  • --info: Show metadata information instead of content/downloading
  • --json: Output metadata as JSON (requires --info)
  • --raw: Fetch raw text content directly from /api/paste/{id}/raw
  • --password [PASSWORD]: Password for protected pastes
  • --key KEY: Decryption key for encrypted pastes/files (or use #k= in URL)
  • --force: Overwrite existing files without confirmation

shorten

Shorten a URL

  • url: The URL to shorten
  • --id: Custom short ID
  • --expiration: Expiration time
  • --burn-after: Number of accesses before the link is burned

config

Manage CLI configuration

  • show: Display all current configuration values
  • set <key> <value>: Set a configuration value
  • get <key>: Read a stored value
  • unset <key>: Remove a configured value (restores default)
  • path: Print the path to the active config file
  • reset: Delete the config file and restore all defaults
  • edit: Open the config file in $VISUAL / $EDITOR

Valid config keys: api_url, expiration, auto_copy, burn_after, json_output, session_cookie, insecure, ca_cert

login

Authenticate with the Binks admin API and persist the session cookie

  • [username]: Admin username (prompts if omitted)

delete

Delete a paste, file, or link by ID (requires admin login)

  • id: The ID of the resource to delete

Dependencies

ID Version
aes-gcm ^0.10
anyhow ^1.0
arboard ^3.6
base64 ^0.22.1
chrono ^0.4.44
clap ^4.6
futures-util ^0.3
indicatif ^0.18
infer ^0.19
is-terminal ^0.4
mime_guess ^2.0
reqwest ^0.13
rpassword ^7.4
serde ^1.0
serde_json ^1.0.149
tempfile ^3.27.0
tokio ^1.51.0
tokio-util ^0.7
toml ^1.1.2
zeroize ^1.8.2
actix-session ^0.11
actix-web ^4.13
reqwest ^0.13
Details
Cargo
2026-04-08 15:43:40 -05:00
3
58 KiB
Assets (1)
Versions (3) View all
0.7.3 2026-04-08
0.7.2 2026-04-08
0.7.1 2026-04-08