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.

39 lines
1.1 KiB

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 <clipp.h>
  13. int main(int argc, char* argv[])
  14. {
  15. using namespace clipp;
  16. using std::cout;
  17. bool recurse = false;
  18. std::string inpath, outpath;
  19. auto cli = (
  20. option("-r", "--recursive").set(recurse) % "recurse into subdirectories",
  21. (required("-i", "--in" ) & value("input dir", inpath)) % "sets path to input directory",
  22. (required("-o", "--out") & value("output dir", outpath)) % "sets path to output directory"
  23. );
  24. if(parse(argc, argv, cli)) {
  25. cout << "read from " << inpath
  26. << (recurse ? " (recursively)" : " (non-recursively)")
  27. << " and write to " << outpath << '\n';
  28. }
  29. else {
  30. cout << make_man_page(cli, argv[0]) << '\n';
  31. }
  32. }