Skip to main content

Copy all your code to your clipboard or a file with one command.

Project description

CopyCode

CopyCode is a CLI tool that gathers your source code files and copies them to your clipboard or saves them to a file. It is especially useful when you want to quickly provide your project's code to AI tools like ChatGPT. The package also displays the number of files processed, total lines of code, and a list of processed files.

Features

  • Copies .py, .js, and .html by default, or any extensions specified via configuration or command-line arguments.
  • Excludes any files or directories you specify in the config file or with the --exclude flag.
  • Generates a header before each file in the combined output.
  • Outputs statistics including the number of files processed and total lines of code.
  • Displays the names of all processed files.
  • Optionally exports the combined code to a text file instead of just copying to the clipboard.
  • Open source, MIT-licensed.
  • can be configured using a config file

Installation

pip install copycode

Usage

copycode [path] [--exclude=files_or_folders] [--filetypes=.py,.js,...] [--outfile=output.txt]

other examples

Copy all .py, .js, and .html files from the current directory

copycode

Specify a different path

copycode /path/to/project

Exclude multiple files or folders

copycode . --exclude=secret.py,test.py

Specify filetypes to process instead of the defaults

copycode . --filetypes=.py,.ts

Save the output to a file instead of copying to clipboard

copycode . --outfile=all_code.txt

Installation

You can create a file named .copyconfig in your project or working directory. By default, copycode looks for a file named .copyconfig in the same directory as the main.py script. If it is not found, the defaults are used.

Below is an example config.yaml:

filetypes:
  - .py
  - .js
  - .html

exclude:
    - secret.py
    - node_modules

If you do not provide a config file, copycode defaults to excluding nothing and processing .py, .js, and .html files only. Any command-line arguments (like --exclude or --filetypes) will override or replace values from the config file.

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

copycode-0.2.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

copycode-0.2.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file copycode-0.2.1.tar.gz.

File metadata

  • Download URL: copycode-0.2.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for copycode-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e630f4d197a93a7c83ba5a5ebd3893927328d7e28354e9badd3a67256c4527c6
MD5 4dd7aea68b33ce6e2046b84efe4e5138
BLAKE2b-256 8e4116cf56c4cc25d28cf33f6a5de30059f4cce06dcdafb3e70e1b92790608c6

See more details on using hashes here.

File details

Details for the file copycode-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: copycode-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for copycode-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c68cd5c50148472ff027b0e750bbc7e5fb3950906fc8ba3e0184f0c2f6d4cc1
MD5 f2eb4cf17b1b311cd047af4aebe6bc29
BLAKE2b-256 5b01735b988a8c24676389123b6cd64691f3e7635d25bb0cc1c142b8a450feae

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