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.

33 lines
784 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 <vector>
  12. #include <cmath>
  13. #include <clipp.h>
  14. int main(int argc, char* argv[])
  15. {
  16. using namespace clipp;
  17. using std::cout;
  18. std::vector<float> nums;
  19. auto cli = required("--data") & numbers("number", nums);
  20. if(parse(argc, argv, cli)) {
  21. cout << "numbers:\n";
  22. for(auto n : nums) cout << n << '\n';
  23. } else {
  24. cout << "Usage:\n" << usage_lines(cli, argv[0]) << '\n';
  25. }
  26. }