diff --git a/Hazelnupp/CmdArgsInterface.cpp b/Hazelnupp/CmdArgsInterface.cpp index 7340613..bfddafd 100644 --- a/Hazelnupp/CmdArgsInterface.cpp +++ b/Hazelnupp/CmdArgsInterface.cpp @@ -439,6 +439,7 @@ std::string CmdArgsInterface::GenerateDocumentation() const bool required = false; bool typeIsForced = false; std::string defaultVal; + std::string incompatibilities; }; std::unordered_map paramInfos; @@ -478,19 +479,33 @@ std::string CmdArgsInterface::GenerateDocumentation() const cached.typeIsForced = it.second.constrainType; cached.type = DataTypeToString(it.second.requiredType); - std::stringstream defaultValueSs; + // Build default-value string + std::stringstream vec2str_ss; for (const std::string& s : it.second.defaultValue) { - defaultValueSs << '\'' << s << '\''; + vec2str_ss << '\'' << s << '\''; // Add a space if we are not at the last entry if ((void*)&s != (void*)&it.second.defaultValue.back()) - defaultValueSs << " "; + vec2str_ss << " "; } - cached.defaultVal = defaultValueSs.str(); + cached.defaultVal = vec2str_ss.str(); + + + // Build incompatibilities string + vec2str_ss.str(""); + for (const std::string& s : it.second.incompatibleParameters) + { + vec2str_ss << s; + + // Add a comma-space if we are not at the last entry + if ((void*)&s != (void*)&it.second.incompatibleParameters.back()) + vec2str_ss << ", "; + } + cached.incompatibilities = vec2str_ss.str(); } - // Now generate the documentatino body + // Now generate the documentation body if (paramInfos.size() > 0) { ss << std::endl @@ -517,6 +532,10 @@ std::string CmdArgsInterface::GenerateDocumentation() const if (pde.defaultVal.length() > 0) ss << "default=[" << pde.defaultVal << "] "; + // Put incompatibilities + if (pde.incompatibilities.length() > 0) + ss << "incompatibilities=[" << pde.incompatibilities << "] "; + // Put required tag, but only if no default value if ((pde.required) && (pde.defaultVal.length() == 0)) ss << "[[REQUIRED]] "; diff --git a/Hazelnupp/Hazelnupp.vcxproj b/Hazelnupp/Hazelnupp.vcxproj index 8c6cbe2..5ba005c 100644 --- a/Hazelnupp/Hazelnupp.vcxproj +++ b/Hazelnupp/Hazelnupp.vcxproj @@ -162,6 +162,7 @@ + diff --git a/Hazelnupp/Hazelnupp.vcxproj.filters b/Hazelnupp/Hazelnupp.vcxproj.filters index b6a229d..ae287d0 100644 --- a/Hazelnupp/Hazelnupp.vcxproj.filters +++ b/Hazelnupp/Hazelnupp.vcxproj.filters @@ -83,5 +83,8 @@ Headerdateien + + Headerdateien + \ No newline at end of file diff --git a/Hazelnupp/Version.h b/Hazelnupp/Version.h index ca90f4d..4cda2cb 100644 --- a/Hazelnupp/Version.h +++ b/Hazelnupp/Version.h @@ -1,2 +1,2 @@ #pragma once -#define HAZELNUPP_VERSION (1.1) +#define HAZELNUPP_VERSION (1.11) diff --git a/StaticTestProject/main.cpp b/StaticTestProject/main.cpp index 07ce55f..e290bae 100644 --- a/StaticTestProject/main.cpp +++ b/StaticTestProject/main.cpp @@ -25,7 +25,7 @@ int main(int argc, char** argv) args.RegisterConstraint("--name", ParamConstraint(true, DATA_TYPE::LIST, { "peter", "hannes" }, true, {})); args.RegisterConstraint("--fruit", ParamConstraint(true, DATA_TYPE::STRING, {}, true, {})); - args.RegisterConstraint("--make-food-delicious", ParamConstraint::Incompatibility("--make-food-disgusting")); + args.RegisterConstraint("--make-food-delicious", ParamConstraint::Incompatibility({ "--make-food-disgusting" , "--foo"})); args.Parse(argc, argv);