From 11d02293868800d7f5e31b5097e6f0bab0dbf9bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Wed, 22 Apr 2015 00:16:50 +0200 Subject: [PATCH] Saving designed syntax --- README | 11 +++++++++++ src/main.cpp | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/README b/README index ec423e5..add8614 100644 --- a/README +++ b/README @@ -1 +1,12 @@ Command, a C++ library for handling command line arguments + +Designing to be used like follows: + +Example: + command::Command command(argc, argv, { + command::Option("f", "File path", [](std::string value)->void { cout << "Sth: " << value << endl; }), + command::Argument("File path", []()->void { cout << "Sth: " << value << endl; }), + command::Option("help", "Help description", [](void)->void { cout << "Sth: " << value << endl; }), + command::Option("verbose", "Verbose option description", &myClass->verbose) + }); + diff --git a/src/main.cpp b/src/main.cpp index 379d14a..37ca36f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,11 @@ int main() { + command::Command command(argc, argv, { + command::Option("f", "File path", [](std::string value)->void { cout << "Sth: " << value << endl; }), + command::Argument("File path", []()->void { cout << "Sth: " << value << endl; }), + command::Option("help", "Help description", [](void)->void { cout << "Sth: " << value << endl; }), + command::Option("verbose", "Verbose option description", &myClass->verbose) + }); + return 0; } \ No newline at end of file -- 2.30.2