Introducing mproj

mproj is a rather small bash script that generates C or C++ project templates depending on your needs.

Have you ever worked with an editor like Vim or Emacs and all the time you had to copy / paste a Makefile sample from some other project of yours or one that you have found online and you struggled to make it work for a simple project of yours?

Yep, that had happened to me more than cannot imagine how furious I was when I had to repeat the same procedure for every single project of mine.

I know what you are thinking right now and let me answer immediately: there is no reason to use an IDE for the sake of a demo project; with an editor like Vim, the editor I personally use and like, a couple of megabytes of memory are more than fine and work just fine.

For heaven's sake, why would I force someone to use an IDE just because I happened to use it for a project of mine? Well, since certain IDEs do not export makefiles successfully, you have to either do a double work or go with the old method.

That's why I have decided to follow the good ol' traditional K.I.S.S. concept: keeping things as simple as possible.

So, how this mproj actually works? It's very easy to use it and convenient too. It comes with preset flags that let you choose between C and C++ standards.

The following flags are preconfigured:

  • --c89
  • --c99
  • --c11
  • --c++98
  • --c++11
  • --c++14

In other words, by choosing, let's say --c++11 flag, it will generate an empty C++ project with preset standard flag to support C++11.

Pretty cool, don't you think?

Here's an example:

bash mproj/ --c++11 /tmp/myFirstDemo

It generates a C++11 project template inside /tmp/ directory and named it myFirstDemo.

OK, but what happens if you forget to insert a project name as your second argument?

Well, because I done this a couple of times by mistake, I have decided to default it to [FLAG]_demo, meaning that our previous example without given the project name, it should have had generated c++11_demo at the current working directory.

That's it.

I hope you enjoy it as much as I did while writing it.

Happy coding, enjoy!