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
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 "clipp.h"
  12. int main(int argc, char* argv[])
  13. {
  14. using namespace clipp;
  15. using std::cout;
  16. bool rec = false, utf16 = false;
  17. std::string infile = "";
  18. std::string fmt = "csv";
  19. auto cli = (
  20. value("input file", infile),
  21. option("-r", "--recursive").set(rec).doc("convert files recursively"),
  22. option("-o") & value("output format", fmt),
  23. option("-utf16").set(utf16).doc("use UTF-16 encoding")
  24. );
  25. if(!parse(argc, argv, cli)) {
  26. cout << make_man_page(cli, "convert");
  27. }
  28. else {
  29. cout << "input file: " << infile << '\n'
  30. << "format: " << fmt << '\n'
  31. << "recursive: " << (rec ? "yes\n" : "no\n")
  32. << "UTF-16: " << (utf16 ? "yes\n" : "no\n");
  33. }
  34. }