From 5c302b3363bb33ac8fc010a2cfbe84f3cefb6bdd Mon Sep 17 00:00:00 2001 From: Thraix Date: Thu, 10 Oct 2019 21:54:53 +0200 Subject: [PATCH] Update README and minor changes logs --- README.md | 11 +++++++++-- src/ConfigCLI.cpp | 9 +++++++-- src/main.cpp | 1 - 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 05d245d..fc2715a 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,20 @@ This will install MakeGen into `/usr/bin/makegen`. If you want it to be installed in another place just run `make` and copy the file to where you want it. ## Usage +### Config file In order to create a MakeGen configuration file use the following command: - makegen --conf + makegen conf gen prompt This will prompt you with all the needed configurations in order to create a Makefile which will compile your code. When this is done it will create a file called `makegen.conf` which contains all relevant data for MakeGen to create a Makefile. +If you want to change your config you can modify the makegen.conf file or use makegens config command line interface. +To see the possible changes you can do see the help file by entering: + + makegen conf + +### Compiling After that simply compile your code with: makegen @@ -52,4 +59,4 @@ If multiple options are given to MakeGen it will execute them in the following o clean all install run Since MakeGen generates include dependencies in your Makefile it can cause the Makefile to get very cluttered. -In order to make it less cluttered you can run `makegen --simple` which will generate (and run) a Makefile without header file dependencies. +In order to make it less cluttered you can run `makegen --simple` which will generate (and run) a Makefile without header file dependencies. \ No newline at end of file diff --git a/src/ConfigCLI.cpp b/src/ConfigCLI.cpp index 6bafe1f..d8d8796 100644 --- a/src/ConfigCLI.cpp +++ b/src/ConfigCLI.cpp @@ -149,7 +149,7 @@ int ConfigCLI::Gen(int argc, char** argv) } if(argc < 2) { - LOG_ERROR("gen needs exactly one parameters"); + LOG_ERROR("gen needs exactly one parameter"); return 1; } std::string option = argv[1]; @@ -292,7 +292,7 @@ int ConfigCLI::Get(int argc, char** argv, ConfigFile& config) } if(argc != 2) { - LOG_ERROR("get needs exactly one parameters"); + LOG_ERROR("get needs exactly one parameter"); return 1; } auto settingVectorMap = GetSettingVectorMap(config); @@ -336,6 +336,11 @@ int ConfigCLI::Main(int argc, char** argv) std::string command = argv[1]; if(command == "gen") { + if(config) + { + LOG_ERROR("Config file already exist (makegen.conf)"); + return 1; + } return Gen(argc-1, &argv[1]); } else if(config) diff --git a/src/main.cpp b/src/main.cpp index e27848a..dcb043e 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -188,6 +188,5 @@ int main(int argc, char** argv) else { LOG_ERROR("No ", CONFIG_FILENAME, " or Makefile found."); - PrintHelp(); } }