build-cpp / cmkr

Modern build system based on CMake and TOML.
https://cmkr.build
MIT License
425 stars 28 forks source link

Find a way to unify documentation #12

Open mrexodia opened 3 years ago

mrexodia commented 3 years ago

Currently the cmkr executable has it's own hardcoded documentation built-in. It would be best if there could be a single source of documentation that is somehow generated into the project to decrease the maintenance burden.

darknessxk commented 2 years ago

Maybe we should use Doxygen as an alternative to the old documentation I've made?

I'll analyze the complexity of applying it for the current project state

darknessxk commented 2 years ago

I've found this if you find this a good alternative and is less harder to maintain in the long run

https://github.com/matusnovak/doxybook2

mrexodia commented 2 years ago

I don’t think Doxygen will help because it focuses mostly on code-level documentation and this is a more high-level type of documentation that has nothing to do with the code.

I’m still thinking about a design to make the whole toml parsing a declarative system where metadata can then be applied, but honestly it’s not so bad.

For the command line argparse is a small library with a decent help generator so that would solve that need.

darknessxk commented 2 years ago

I'll check out some other ideas but wrapping our current argument parsing method using some class to generate this info can be a good

Like creating a pattern like this

class CliArgument {
private:
 const char* tag;
 const char* description;
public:
 CliArgument(const char* _tag, const char* _desc): tag(_tag), description(_desc) {}

 const char* getTag() { return tag; }
 const char* getDescription() { return description; }
}

CliArgument outputArg { "--output", "File output" };

void ShowHelp() {
  // render all CliArgument tag + description here
}

This can works I think let me know your opinion about it

** This is really abstract idea, so don't think this as a final stuff just a concept

mrexodia commented 2 years ago

For the argument parsing this library is probably pretty good: https://github.com/Taywee/args#simple-example

Combined with a little cmake to automatically generate the documentation it’s enough for the command line part at least.