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.

35 lines
841 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<double> nums;
  19. auto cli = joinable( repeatable(
  20. option(",") , opt_number("number", nums)
  21. ) );
  22. if(parse(argc, argv, cli)) {
  23. cout << "numbers:\n";
  24. for(auto n : nums) cout << n << '\n';
  25. } else {
  26. cout << "Usage:\n" << usage_lines(cli, argv[0]) << '\n';
  27. }
  28. }