DEV Community

Cover image for Create README files for your project in 30 seconds ⚡
Dhravya
Dhravya

Posted on • Edited on

Create README files for your project in 30 seconds ⚡

I'm the type of person who keeps creating different repositories and small open-source projects.
One major problem I was having was, making the README files would be so boring :(

After completing the monkeytype bot project, I had to write a README for it. Like any other programmer, instead of taking 5 minutes to write the readme, I spent the next 2 hours automating the same - in Rust.

I was looking for a good, useful, but easy project to practice and polish my Rust skills, and this was the perfect idea, since it’s so useful for me.

So here it is! The README generator
short demo

Here's the project on github:
Readme Card

If you want to read about the process of making it, read my blog post here - https://blog.dhravya.dev/readme-generator/
I didn't publish it to dev.to because, honestly, most people would find it boring lol

How to use it

If you have cargo installed, it's remarkably easy to install and use-

cargo install readme-generator
readme-generator.exe
Enter fullscreen mode Exit fullscreen mode

That's it!

If you don't have cargo installed, you'll have to download the exe file from github here: https://github.com/Dhravya/readme-generator/releases

Please leave your feedback here on how I can improve this project and if you used it, leave a ⭐ on Github and comment on this post!

Top comments (11)

Collapse
 
miguelmj profile image
MiguelMJ

It would be nice if this post had shown some examples of how it works, where does it take the info of the project to write it in the README...
I think it's a very cool project!

Collapse
 
dhravya profile image
Dhravya

Alright, so here's how it goes:

Basic information that the code can't figure out is asked in the terminal, all variables are stored and then it goes through a function called file_factory. the file factory has a very basic job.

It creates the README file, and puts in the variable (as Yassin pointed out)
But, the special part is, it looks for the files in the current directory. According the files, it creates installation and usage instructions

It also takes the git url by executing a command

It's honestly pretty basic stuff, one of my first rust project lol

Collapse
 
yassineldeeb profile image
Yassin Eldeeb 🦀 • Edited

Nice! Keep it up.

Another thing to consider is to put #rust as a tag to this blog, that's the most advanced marketing technique, trust me people love Rust 😂😂.

Collapse
 
yassineldeeb profile image
Yassin Eldeeb 🦀 • Edited

It's actually really really simple, It's just a template Readme with placeholders like $PROJECT_NAME ..etc and he reads that template locally from the filesystem or from a string literal stored directly in the program's binary. The CLI prompts you to a few questions and every time you answer a question he go and replace the placeholder with what you have typed. And Voila! you now have a string containing all of the customized Readme information, just dumb it to the terminal.

Collapse
 
dhravya profile image
Dhravya

not exactly like that

Collapse
 
dhravya profile image
Dhravya

Not really, there's quite a bit of automation involved (Generating the installation and usage on it's own for example)

But eh sure ig

Collapse
 
gogi2811 profile image
gogi2811

“If you have to do it manually more than 3 times then it needs to be automated.”
Very cool what you have implemented

Collapse
 
dhravya profile image
Dhravya

Thank you so much!

Collapse
 
chiemali profile image
magicfingers

I love the project and I want to use it to create a Readme Dhravya but I don't know. How can I use it in my github repo?

Collapse
 
dhravya profile image
Dhravya • Edited

Hi there! to use this in your project:

  1. Install cargo if you don't have it already (cargo is a very useful package manager commonly used for Rust projects)
  2. Just run this command:
cargo install readme-generator
Enter fullscreen mode Exit fullscreen mode
  1. And finally, just run this command
readme-generator.exe
Enter fullscreen mode Exit fullscreen mode

That's it.