7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2024-11-22 03:15:02 +00:00
kicad/thirdparty/argparse/samples/repeating_argument_to_increase_value.cpp
2022-11-13 11:50:27 -05:00

20 lines
492 B
C++

// SPDX-License-Identifier: MIT
#include <argparse/argparse.hpp>
int main(int argc, char *argv[]) {
argparse::ArgumentParser program("test");
int verbosity = 0;
program.add_argument("-V", "--verbose")
.action([&](const auto &) { ++verbosity; })
.append()
.default_value(false)
.implicit_value(true)
.nargs(0);
program.parse_args(argc, argv); // Example: ./main -VVVV
std::cout << "verbose level: " << verbosity << std::endl; // verbose level: 4
}