From 4b983b8f035dbd854edc3fd50c767d913bf775ad Mon Sep 17 00:00:00 2001 From: Pavel Belikov Date: Sat, 23 Dec 2017 21:07:26 +0300 Subject: add examples --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index f3a35d8..5327549 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ It: * Allows one value flag to take a specific number of values (like `--foo first second`, where --foo slurps both arguments). * Allows you to have value flags only optionally accept values +* Provides autocompletion for bash # What does it not do? @@ -179,10 +180,16 @@ int main(int argc, char **argv) { args::ArgumentParser parser("This is a test program.", "This goes after the options."); args::HelpFlag help(parser, "help", "Display this help menu", {'h', "help"}); + args::CompletionFlag completion(parser, {"complete"}); try { parser.ParseCLI(argc, argv); } + catch (args::Completion e) + { + std::cout << e.what(); + return 0; + } catch (args::Help) { std::cout << parser; -- cgit v1.2.1