From: Rafał Długołęcki Date: Tue, 21 Apr 2015 22:16:50 +0000 (+0200) Subject: Saving designed syntax X-Git-Tag: v0.2~48 X-Git-Url: https://git.dlugolecki.net.pl/?p=command.git;a=commitdiff_plain;h=11d02293868800d7f5e31b5097e6f0bab0dbf9bc Saving designed syntax --- 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