Skip to content

Commit 4f4be4b

Browse files
committed
Add --help message
1 parent 9852b51 commit 4f4be4b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/cli/convert_json_toml.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <cstdlib>
2+
#include <cstring>
13
#include <openPMD/auxiliary/JSON_internal.hpp>
24

35
#include <iostream>
@@ -39,6 +41,21 @@ int main(int argc, char const **argv)
3941
std::cin >> jsonOrToml;
4042
break;
4143
case 2:
44+
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)
45+
{
46+
std::cout << "Usage: " << std::string(argv[0]) << R"( [json_or_toml]
47+
'json_or_toml' can be a JSON or TOML dataset specified inline or a reference
48+
to a file prepended by an '@'.
49+
Inline datasets will be interpreted as JSON if they start with an '{', as TOML
50+
otherwise. Datasets from a file will be interpreted as JSON or TOML depending
51+
on the file ending '.json' or '.toml' respectively.
52+
Inline dataset specifications can be replaced by input read from stdin.
53+
54+
If the input is JSON, then it will be converted to TOML and written to stdout,
55+
equivalently from TOML to JSON.
56+
)";
57+
exit(0);
58+
}
4259
jsonOrToml = argv[1];
4360
break;
4461
default:

0 commit comments

Comments
 (0)