-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Generate config descriptions #1842
base: develop
Are you sure you want to change the base?
feat: Generate config descriptions #1842
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1842 +/- ##
===========================================
- Coverage 71.75% 71.74% -0.02%
===========================================
Files 324 332 +8
Lines 13265 13504 +239
Branches 6742 6865 +123
===========================================
+ Hits 9518 9688 +170
- Misses 1907 1925 +18
- Partials 1840 1891 +51 ☔ View full report in Codecov by Sentry. |
src/app/CliArgs.cpp
Outdated
@@ -44,6 +45,7 @@ CliArgs::parse(int argc, char const* argv[]) | |||
description.add_options() | |||
("help,h", "print help message and exit") | |||
("version,v", "print version and exit") | |||
("description,d", "generate config description") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
("description,d", "generate config description") | |
("config-description,d", "generate config description") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it probably should take a string where to put output file.
if (!file.is_open()) | ||
return std::unexpected<Error>{fmt::format("failed to create file: {}", kCONFIG_DESCRIPTION_FILE_NAME)}; | ||
|
||
file << "# Config Description Markdown File\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file << "# Config Description Markdown File\n"; | |
file << "# Clio Config Description\n"; |
return std::unexpected<Error>{fmt::format("failed to create file: {}", kCONFIG_DESCRIPTION_FILE_NAME)}; | ||
|
||
file << "# Config Description Markdown File\n"; | ||
file << "This is a **markdown** file listing all Clio Configurations in detail.\n\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you think it is important to specify that this is a markdown file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea true, it's not important to say this is a markdown file
|
||
for (auto const& [key, val] : kCONFIG_DESCRIPTION) { | ||
file << "### " << key << "\n"; | ||
file << val << "\n\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to also add type and constraints for each config entry.
tests/unit/app/CliArgsTests.cpp
Outdated
TEST_F(CliArgsTests, Parse_ConfigDescription) | ||
{ | ||
using namespace util::config; | ||
std::array argv{"clio_server", "--description"}; // NOLINT(bugprone-suspicious-stringview-data-usage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the comment be on the next line?
Fixes #1460