DEV Community

forrest
forrest

Posted on

code2text

Sending code can be a pain. Virus filters, attachment rules, and more can make it difficult. Sometimes you just need a text file.

Enter code2text. This is a simple Go CLI tool that will traverse a project's directories and add all code to a single text document. This document can then be uploaded to an AI tool such as ChatGPT for analysis.

The created file will start with the directory structure, then the files. The defaults contain file extensions and directories to include/exclude for many popular languages, but can be overridden. Check the help code2text -h for details.

If, for some reason, you want to turn the output file into a directory structure resembling the original, use text2code. Note: this will not create a complete, compilable project as many files and directories may be excluded.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay