Skip to main content

Extensible code concatenator and clipboard tool

Project description

cbler

Concatenate code into your clipboard with filters.

cbler is a CLI tool for extracting source files, filtering them, and copying the result to your clipboard. It also includes several helpful Git utilities for viewing logs and diffs.

  • Built with Typer
  • Rich, colorful output
  • Multi-flag filtering with regex support
  • Git integration for diffs and logs
  • Designed for piping code into LLMs like ChatGPT, Claude, or Gemini

Install

pip install cbler

CLI Layout

cbler code <lang> [path] [filters]
cbler git log [path] [options]
cbler git diff [path] [options]
cbler git tree [path] [options]
cbler git merge [path]

code Command

The code command is the core of cbler. It walks a directory, finds files matching the specified language (py or gml), applies a series of filters, and copies the concatenated result to the clipboard.

Usage

# Copy all python files in the current directory, excluding test files
cbler code py . --not-suffix _test.py

# Copy all GameMaker scripts containing "Player" in their path
cbler code gml . --path-contains Player

# Copy all python files that have been changed in git (unstaged)
cbler code py . --git-diff

Code Command Filters

All filters are optional and can be combined. They accept multiple values (e.g., --suffix .py .pyw) and support regex patterns by default (disable with --no-regex).

Filter Description
--prefix, --not-prefix Match file names that start with a pattern.
--suffix, --not-suffix Match file names that end with a pattern.
--contains, --not-contains Match file names that contain a pattern.
--path-contains, --not-path-contains Match the full relative path against a pattern.
--parent-contains Parent directory must match ANY of the given patterns.
--parent-contains-all Parent directory must match ALL of the given patterns.
--git-diff Only include files that are part of the unstaged git diff.
--git-staged Only include files that have been staged in git.
--no-regex Disable regex matching for all filters.

git Command

The git command provides several utilities for inspecting a Git repository.

git log

Shows a detailed, formatted log of the most recent commits.

cbler git log . -n 20  # Show last 20 commits

Author names are colorized with deterministic colors so different contributors stand out in the table.

git diff

Displays a summary of file changes (modified, added, deleted, untracked).

cbler git diff             # Show unstaged changes and untracked files
cbler git diff --staged    # Show only staged changes
cbler git diff --no-untracked # Hide untracked files

Each status letter is colored (e.g. green for added, yellow for modified) so changes are easier to spot.

git tree

Displays a compact, graphical representation of the commit history.

cbler git tree -n 30  # Show a graph of the last 30 commits

git branch

Interactive branch switcher. Launches a TUI showing all branches. Use the arrow keys to select a branch and press Enter to switch. Press n or choose "+ New Branch" to create one.

cbler git branch            # Open the TUI
cbler git branch --help     # Show options

git merge

Launches an interactive UI for merging another branch into the current one.

cbler git merge .

Use the arrow keys to choose a branch and press Enter to perform the merge. After completion, a reminder to push is shown. If textual is not installed or the terminal is non-interactive, a short message suggests installing it with uv add textual.


Roadmap

  • --max-files limit with confirmation
  • Progress bar
  • --output for saving to file
  • Show skipped files with reasons

Dev install

uv pip install -e .
cbler code py . --suffix .py

License

MIT


Name

"cbler" = clipboard + -ler

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cbler-1.2.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cbler-1.2.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file cbler-1.2.0.tar.gz.

File metadata

  • Download URL: cbler-1.2.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cbler-1.2.0.tar.gz
Algorithm Hash digest
SHA256 0beaa84347f7e6976e22b0a9746dae686cba6252aaa51148d5abbaa80622f43e
MD5 1c36e8bd50a3abafcd088cf43aae0eae
BLAKE2b-256 0b3a4285a26d919421d76fef04fd7d1a4bb2e117e3b3ef941f882122433a620d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbler-1.2.0.tar.gz:

Publisher: workflow.yml on Gaburyuu/CBler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbler-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: cbler-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cbler-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3664068201ec0ccd0ce1ffe6f3f52110d61938236da87b30848d0804795d7b6e
MD5 6006548ebac588d10f7e16a098f8f1dc
BLAKE2b-256 1c4c4ff8b944519a352ebb59e3a2add3a732ef1a86467e6caaaabefda4aa2806

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbler-1.2.0-py3-none-any.whl:

Publisher: workflow.yml on Gaburyuu/CBler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page