Skip to main content

A CLI tool to copy code files from a directory to the clipboard

Project description

CopyClip

A command-line tool that helps you copy multiple code files from a directory to your clipboard. Perfect for sharing code snippets, preparing documentation, and especially useful when working with Large Language Models (LLMs).

Features

  • Copy multiple files to clipboard with a single command
  • Smart file filtering with gitignore support
  • Hidden files/directories handling
  • LLM-friendly output formatting with relative paths
  • Verification of clipboard operations
  • Fallback to file output if clipboard fails

Why CopyClip + LLMs?

CopyClip is designed to enhance your workflow with AI coding assistants like ChatGPT, Claude, or GitHub Copilot by:

  • Easily sharing entire codebases or specific directories for context
  • Maintaining proper file structure and formatting
  • Streamlining code reviews and discussions
  • Enabling quick context switching in AI conversations
  • Preserving folder structure through relative path headers

Each file is concatenated with its relative path as a header, helping AI assistants understand your project's structure:


--- File: src/models/user.py ---
class User:
    def __init__(self):
        pass

--- File: src/utils/helpers.py ---
def format_date():
    return "2024-01-01"

--- File: src/main.py ---
from models.user import User
from utils.helpers import format_date

This structured format helps AI assistants:

  • Understand file relationships and imports
  • Provide more contextual code suggestions
  • Better grasp your project architecture
  • Generate more accurate responses about your codebase

Installation


pip install copyclip

Usage

Basic usage:


copyclip /path/to/directory

Advanced options:


# Ignore specific patterns
copyclip /path/to/directory --ignore "*.js" "*.pyc" "node_modules/*"

# Respect .gitignore patterns
copyclip /path/to/directory --gitignore

# Include hidden files
copyclip /path/to/directory --include-hidden

# Print output to console
copyclip /path/to/directory --print

Arguments

Argument Description
path Root path of the directory to process
--ignore List of regex patterns to ignore files (e.g., .js, .env, index)
--gitignore Also respect .gitignore patterns
--include-hidden Include hidden files and directories (starting with .)
--print Print the concatenated output to console

Example Output

When you run CopyClip on a project, it generates a formatted output like this:


--- File: src/main.py ---
def main():
    print("Hello, World!")

--- File: tests/test_main.py ---
def test_main():
    assert True

--- File: utils/helpers.py ---
def helper_function():
    return "I'm helping!"

This format ensures that:

  • File paths are clearly visible
  • Code structure is preserved
  • AI assistants can understand the project hierarchy
  • Code relationships are maintained

Requirements

  • Python 3.6+
  • pyperclip

License

MIT License

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

copyclip-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

copyclip-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file copyclip-0.1.0.tar.gz.

File metadata

  • Download URL: copyclip-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for copyclip-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1df3ae832e661642bc122b7b60fd6e318ad0b167e9aa643fda079d39e79ad84c
MD5 94a7fb2242d012c826660aca9376d50e
BLAKE2b-256 31acd590dd9e1ea96d65369ae7197a35f54c27d694c7680a7209e462baccdcc9

See more details on using hashes here.

File details

Details for the file copyclip-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: copyclip-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for copyclip-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d96e9033e918049b194f090af39e6d39817ee17ef8347492c8a2af15df09dd79
MD5 d9011e9f4a0661d9bd9c9f4595c425c1
BLAKE2b-256 cdf768642c1ef82a58d09a5c34c8543edbb6a77e7dacef42dd8dc7c7875ba49c

See more details on using hashes here.

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