23 #include "openPMD/Series.hpp" 24 #include "openPMD/helper/list_series.hpp" 37 inline void print_help(std::string
const program_name)
39 std::cout <<
"Usage: " << program_name <<
" openPMD-series\n";
40 std::cout <<
"List information about an openPMD data series.\n\n";
41 std::cout <<
"Options:\n";
42 std::cout <<
" -h, --help display this help and exit\n";
44 <<
" -v, --version output version information and exit\n";
46 std::cout <<
"Examples:\n";
47 std::cout <<
" " << program_name
48 <<
" ./samples/git-sample/data%T.h5\n";
49 std::cout <<
" " << program_name
50 <<
" ./samples/git-sample/data%08T.h5\n";
51 std::cout <<
" " << program_name
52 <<
" ./samples/serial_write.json\n";
53 std::cout <<
" " << program_name
54 <<
" ./samples/serial_patch.bp\n";
57 inline void print_version(std::string
const program_name)
59 std::cout << program_name <<
" (openPMD-api) " <<
getVersion()
61 std::cout <<
"Copyright 2017-2021 openPMD contributors\n";
62 std::cout <<
"Authors: Axel Huebl et al.\n";
63 std::cout <<
"License: LGPLv3+\n";
65 <<
"This is free software: you are free to change and " 67 "There is NO WARRANTY, to the extent permitted by law.\n";
75 inline int run(std::vector<std::string>
const &argv)
78 auto const argc = argv.size();
86 for (
int c = 1; c < int(argc); c++)
88 if (std::string(
"--help") == argv[c] ||
89 std::string(
"-h") == argv[c])
94 if (std::string(
"--version") == argv[c] ||
95 std::string(
"-v") == argv[c])
97 print_version(argv[0]);
104 std::cerr <<
"Too many arguments! See: " << argv[0]
114 R
"({"defer_iteration_parsing": true})"); 116 helper::listSeries(s, true, std::cout);
118 catch (std::exception
const &e)
120 std::cerr <<
"An error occurred while opening the specified " 122 std::cerr << e.what() << std::endl;
Root level of the openPMD hierarchy.
Definition: Series.hpp:537
std::string getVersion()
Return the version of the openPMD-api library (run-time)
Definition: version.cpp:26
Public definitions of openPMD-api.
Definition: Date.cpp:28
open series as read-only, fails if series is not found