TeaserPaste's new CLI https://pastevault.web.app/docs/cli
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-02 05:45:49 +07:00
.github/workflows Update daily.yml 2026-03-07 10:26:25 +07:00
src change URLs 2026-08-02 05:45:49 +07:00
.gitignore Implement edit command, JSON output, upgrades and config 2026-01-10 02:38:54 +07:00
Cargo.lock change URLs 2026-08-02 05:45:49 +07:00
Cargo.toml change URLs 2026-08-02 05:45:49 +07:00
dist-workspace.toml feat: add Homebrew installation 2026-02-20 01:47:03 +07:00
LICENSE_APACHE Create LICENSE_APACHE 2026-01-09 11:26:36 +07:00
LICENSE_MIT Create LICENSE_MIT 2026-01-09 11:26:09 +07:00
README.md docs: add installation guide for Homebrew 2026-02-20 01:49:46 +07:00

TeaserPaste CLI (tpc)

TeaserPaste CLI (tpc) is a powerful command-line interface for interacting with TeaserPaste. It allows you to create, view, manage, and even execute code snippets directly from your terminal.

Features

  • Manage Snippets: Create, view, update, delete, and restore snippets.
  • Execute Code: Run snippets locally in various languages (Python, JS, Rust, Go, etc.) with tpc run.
  • Dependency Management: Automatically detects and installs dependencies for supported languages when running snippets.
  • Secure: Manages API tokens securely using the system keyring.
  • Developer Friendly: Clipboard integration, and interactive modes.

Installation

You can install tpc using the automated installer script (powered by cargo-dist):

Linux & macOS:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/TeaserPaste/tpcli/releases/latest/download/tpc-installer.sh | sh

Windows (PowerShell):

powershell -ExecutionPolicy Bypass -c "irm https://github.com/TeaserPaste/tpcli/releases/latest/download/tpc-installer.ps1 | iex"

Note for Windows ARM64 users: Currently, we do not provide a native aarch64-pc-windows-msvc binary. Please use the x86_64 version.

Method 2: Cargo

If you have Rust installed, you can install the CLI directly from Crates.io:

cargo install tpc

Note: Ensure ~/.cargo/bin is in your PATH.

Method 3: Homebrew

For macOS and Linux users:

brew install TeaserPaste/tools/tpc

Configuration

Before creating or managing private snippets, you need to authenticate.

  1. Get your API Token from your TeaserPaste account settings.
  2. Run the following command:
tpc config set token YOUR_API_TOKEN

The token is stored securely in your operating system's keychain/keyring.

Other Configuration Options:

You can also set default preferences:

# Set default language
tpc config set default_language rust

# Set default visibility
tpc config set default_visibility private

# View current config
tpc config get default_language

# Clear a config
tpc config clear default_visibility

Usage

Here are some common examples of how to use tpc.

1. Create a Snippet

Interactive Mode (Easiest):

tpc create --interactive
# or simply
tpc create -i

From a File:

tpc create --file ./script.py --title "My Python Script" --visibility public

From Stdin:

echo "console.log('Hello World')" | tpc create --title "Hello" --language javascript

2. View a Snippet

View a snippet:

tpc view <SNIPPET_ID>

Copy content directly to clipboard:

tpc view <SNIPPET_ID> --copy

View output as JSON (useful for scripting):

tpc view <SNIPPET_ID> --json

3. Run a Snippet 🏃

You can fetch and execute a snippet locally. tpc supports Python, Node.js, Rust, Go, C++, and more.

tpc run <SNIPPET_ID>

Advanced Run Options:

  • --install-deps: Auto-install detected imports (e.g., npm packages, pip modules) into a temporary environment.
  • --env KEY=VALUE: Pass environment variables.
  • --on-error-paste: If the script fails, automatically upload the error log as a private snippet.
tpc run <SNIPPET_ID> --install-deps --env DEBUG=true

Custom Runners (Dynamic Runner):

You can customize the command used to execute snippets.

  • Via CLI flag: Use --with-runner to specify a command. Use {{file}} as a placeholder for the script path.

    tpc run <ID> --with-runner "python3 {{file}}"
    tpc run <ID> --with-runner "deno run --allow-net {{file}}"
    
  • Via Config: Add a runners map to your config.json file (typically in ~/.config/tpcli/config.json).

    {
      "runners": {
        "python": "python3 {{file}}",
        "javascript": "deno run {{file}}"
      }
    }
    

4. Search Snippets

Search for public snippets by query:

tpc search "rust web server" --limit 5

5. Other Commands

  • Clone to file: tpc clone <ID>
  • Fork/Copy: tpc copy <ID>
  • Statistics: tpc stats
  • Delete: tpc delete <ID>
  • Edit: tpc edit <ID> (Opens snippet in your default editor)
  • Verbose Mode: Use -v, -vv, or -vvv for more detailed logs.

Help

To see the full list of commands and options, run:

tpc --help

License

This project is licensed under the MIT or Apache-2.0 license.