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

Uploaded Python 3

File details

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

File metadata

  • Download URL: copycode-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 24038c060e087fb2fa0b42cfc9d6b12fb7c94913cc54677ea9a945f9c24c9360
MD5 56df2d78913c0fdef001c43313e45fdb
BLAKE2b-256 0869783c79fad7b6f40ec66ab6c57767ebba2a0658765b6168d049746e09297a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: copycode-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a30b6452b100210c4ff35a868cd7ba11276893b13b8b6b1dc02339a494d973ed
MD5 34b40ec6a35225d053dfa009de4e2a08
BLAKE2b-256 b8e3ba6819fc4eb9dcfa032628788e6d33f6b433547deb4d863f1723da55f4d2

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