You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
887 B

2 years ago
  1. /*****************************************************************************
  2. *
  3. * demo program - part of CLIPP (command line interfaces for modern C++)
  4. *
  5. * released under MIT license
  6. *
  7. * (c) 2017-2018 André Müller; foss@andremueller-online.de
  8. *
  9. *****************************************************************************/
  10. #include <iostream>
  11. #include <string>
  12. #include <vector>
  13. #include <clipp.h>
  14. int main(int argc, char* argv[])
  15. {
  16. using namespace clipp;
  17. using std::cout;
  18. auto cli = (
  19. command("make"),
  20. value("file") % "name of file to make",
  21. option("-f", "--force") % "overwrite existing file"
  22. );
  23. parse({"make", "out.txt"}, cli);
  24. auto args = std::vector<std::string> {"make", "out.txt", "-f"};
  25. parse(args, cli);
  26. auto result = parse(argc, argv, cli);
  27. clipp::debug::print(std::cout, result);
  28. }