Metadata-Version: 2.4
Name: osc52
Version: 0.1.0
Summary: Copy stdin or arguments to the system clipboard via the OSC 52 terminal escape sequence — works over SSH + tmux.
Project-URL: Homepage, https://github.com/yeyi0003/osc52
Project-URL: Repository, https://github.com/yeyi0003/osc52
Author: yeyi0003
License: MIT
License-File: LICENSE
Keywords: cli,clipboard,copy,osc52,ssh,terminal,tmux
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# osc52

Copy stdin (or arguments) to the system clipboard via the **OSC 52** terminal
escape sequence. Designed to work over **SSH + tmux**: the escape is written to
stderr, streamed back to your *local* terminal, and routed to your *local*
clipboard — so `ssh server "nvidia-smi | osc52"` copies the remote output to
your local machine, no remote clipboard tool required.

This is the Python port of the Go tool of the same name, distributed on PyPI so
`pip install osc52` gives you the `osc52` command directly.

## Install

```bash
pip install osc52
```

This installs an `osc52` executable onto your `PATH` (an `osc52.exe` shim on
Windows).

## Usage

```bash
# Default: echo input to stdout AND copy to clipboard.
nvidia-smi | osc52

# Copy only, no echo.
nvidia-smi | osc52 -q

# Copy a file.
osc52 < config.yaml

# Copy a literal string.
osc52 "https://example.com/token"
```

## How it works

```
stdin/argv ──▶ echo to stdout (visible) ─────────────────▶ terminal / pipe
          └─▶ base64 ─▶ ESC ] 52 ; c ; <b64> BEL ─▶ stderr ─▶ terminal
                                                              (parses OSC 52
                                                               → local clipboard)
```

- **Echo** goes to **stdout** so downstream pipes stay clean of escape sequences.
- **OSC 52** goes to **stderr** so the terminal still parses it, but it never
  pollutes piped output.
- Large payloads are split into ≤32KB base64 chunks; terminals accumulate
  same-selection sequences into the clipboard.

## Options

| Flag | Meaning |
|------|---------|
| `-q, --quiet` | Do not echo input to stdout |
| `--version` | Print version |
| `-h, --help` | Help |

## Terminal support

OSC 52 is supported by Windows Terminal, iTerm2, kitty, Alacritty, WezTerm,
foot, and recent GNOME Terminal. In tmux, ensure `set -g set-clipboard on`.

## License

MIT
