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 .copyconfig file:

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: copycode-0.2.3.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.3.tar.gz
Algorithm Hash digest
SHA256 86d2f549df1f60b7588b25e40b743100399b36c930b7d933527a612b54b2efe4
MD5 a19ce0ed60556b3bea756ebe72333c94
BLAKE2b-256 5bc1990e0305782a5ba65cf1881e41017d5fa8c19b8345e0dc0b507d0fc56ecf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copycode-0.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dd83169efe951746a563be4daaaac966c811c5af538166d5344acf4b07c753bc
MD5 893a25635c0c1fb4dff9ce0acf540df6
BLAKE2b-256 331e5e0fa206632fde0378f320d87287f420492060ea01e11cdeff5126fa43e1

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