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.2.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.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: copyclip-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0de44600efe07e4052f4eb27b493433a1e6a982c8de6808d7c018ad5211677ab
MD5 49d53c10c478bd038e79ba8bc696ef47
BLAKE2b-256 d23d0b748050e35d9547f57fe2317b4080b39da368db492db7f9ec3f2ed3e5da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copyclip-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bce2387fa621d877bba492e1572e66ef129f9eb8136074b86cfc78a776852c98
MD5 d83e5f5232352f4262a686d2a67cbdb4
BLAKE2b-256 019c14f857666a54a9b5da62f6202281ec188f2b46ea0e57632c93981dd18e66

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