File: completion.cxx

package info (click to toggle)
libargs 6.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 956 kB
  • sloc: cpp: 10,576; makefile: 56; sh: 19; python: 12
file content (27 lines) | stat: -rw-r--r-- 790 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Copyright © 2016-2017 Taylor C. Richberger <taywee@gmx.com> and Pavel Belikov
 * This code is released under the license described in the LICENSE file
 */

#include "args.hxx"
#include <iostream>

int main(int argc, const char **argv)
{
    args::ArgumentParser p("parser");
    args::CompletionFlag c(p, {"complete"});
    args::ValueFlag<std::string> f(p, "name", "description", {'f', "foo"}, "abc");
    args::ValueFlag<std::string> b(p, "name", "description", {'b', "bar"}, "abc");
    args::MapFlag<std::string, int> m(p, "mappos", "mappos", {'m', "map"}, {{"1",1}, {"2", 2}});
    args::Positional<std::string> pos(p, "name", "desc");

    try
    {
        p.ParseCLI(argc, argv);
    }
    catch (args::Completion &e)
    {
        std::cout << e.what();
    }

    return 0;
}