feat(parser): add argument value storage and retrieval

- Implement stored_arguments map to store argument values
- Add get_optional method to retrieve stored values
- Add helper methods for creating parametered and non-parametered actions
- Refactor argument adding logic into smaller methods
- Update main.cpp to demonstrate new storage functionality
This commit is contained in:
2025-10-06 04:06:16 +04:00
parent 9750152dca
commit 8437a00c6b
2 changed files with 83 additions and 17 deletions

View File

@@ -118,7 +118,16 @@ int main() {
parser.display_help(conventions);
}), false);
parser.add_argument<std::string>("t", "test_store", "Test store", false);
parser.handle_arguments(conventions);
auto store = parser.get_optional<std::string>("test_store");
if (store.has_value()) {
std::cout << "Stored value: " << store.value() << std::endl;
} else {
std::cout << "No stored value." << std::endl;
}
return 0;
}