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.1.tar.gz (4.7 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.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for copyclip-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6fe527f485de707cdcdc91ce337ead1862ae85feebe3d443aeeb766e183ab19b
MD5 d4e3a0a99d09c7edc1da34e183f1f3e6
BLAKE2b-256 d5cca6f96884d780189f83ad1d36d67eca56bcf18899c743b748fcd7ab44fbc7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copyclip-0.1.1-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.6

File hashes

Hashes for copyclip-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b696945994bd8dfa5e352d420ed18c6503916cb2e56ae47228f2ab276abeed22
MD5 c7ba83f793dd7659c28cba78a4f32ff3
BLAKE2b-256 44c7e6ef55521b04c79e6cc474248607343f987ddc80a429fc17cf28848b3e17

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