From b457e2ef043ba5b67f73611153c72091f97b9fdc Mon Sep 17 00:00:00 2001 From: Sakars Date: Wed, 1 Jan 2025 20:04:44 +0000 Subject: [PATCH] indentation config option --- README.md | 2 ++ src/main.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index efa3b26..17b7480 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,5 @@ for debugging purposes. - `-n`: Alias for `--namespace`. - `--no-namespace`: Disables generation of namespaces. - `-nn`: Alias for `--no-namespace`. +- `--indent `: Sets the indentation string for generated files. 2 spaces by default. +- `-i`: Alias for `--indent`. diff --git a/src/main.cpp b/src/main.cpp index 4804eb7..72fe991 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -144,6 +144,16 @@ int main(int argc, char* argv[]) { codeProperties.headerGuardType_ = CodeProperties::HeaderGuard::Ifndef; continue; } + if (args[i] == "--indent" || args[i] == "-i") { + if (i + 1 < argc) { + codeProperties.indent_ = args[i + 1]; + i += 1; + continue; + } else { + std::cerr << "Error: --indent requires an argument." << std::endl; + return 1; + } + } if (args[i].starts_with('-')) { std::cerr << "Error: Unknown option " << args[i] << std::endl; return 1;