Skip to content

Commit

Permalink
fix: Add project name to README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Swarnava Mukherjee <[email protected]>
  • Loading branch information
swar-mukh committed Jul 11, 2024
1 parent 24ebfbd commit 70e3752
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion headers/assets/scaffold_texts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace assets::scaffold_texts {
)";

const string README_MD = R"(
# Project name
# @PROJECT_NAME
This project was made using `cbt`
Expand Down
1 change: 1 addition & 0 deletions headers/workspace/scaffold.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace workspace::scaffold {
using std::string;

const std::regex PROJECT_NAME_R{ "@PROJECT_NAME" };
const std::regex IMPORT_R{ "@FILE_NAME" };
const std::regex GUARD_R{ "@GUARD" };
const std::regex NAMESPACE_R{ "@NAMESPACE" };
Expand Down
5 changes: 4 additions & 1 deletion src/workspace/scaffold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ namespace {

return final_text;
} else if (file_name.compare("README.md") == 0) {
return remove_raw_literal_indentations(README_MD);
const string text{ remove_raw_literal_indentations(README_MD) };
const string with_project_name = std::regex_replace(text, PROJECT_NAME_R, project_name);

return with_project_name;
} else if (file_name.compare("project.cfg") == 0) {
using namespace workspace::project_config;

Expand Down

0 comments on commit 70e3752

Please sign in to comment.