Skip to content

Commit

Permalink
Add --help message
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed May 11, 2023
1 parent 9852b51 commit 4f4be4b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/cli/convert_json_toml.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <cstdlib>
#include <cstring>
#include <openPMD/auxiliary/JSON_internal.hpp>

#include <iostream>
Expand Down Expand Up @@ -39,6 +41,21 @@ int main(int argc, char const **argv)
std::cin >> jsonOrToml;
break;
case 2:
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)
{
std::cout << "Usage: " << std::string(argv[0]) << R"( [json_or_toml]
'json_or_toml' can be a JSON or TOML dataset specified inline or a reference
to a file prepended by an '@'.
Inline datasets will be interpreted as JSON if they start with an '{', as TOML
otherwise. Datasets from a file will be interpreted as JSON or TOML depending
on the file ending '.json' or '.toml' respectively.
Inline dataset specifications can be replaced by input read from stdin.
If the input is JSON, then it will be converted to TOML and written to stdout,
equivalently from TOML to JSON.
)";
exit(0);
}
jsonOrToml = argv[1];
break;
default:
Expand Down

0 comments on commit 4f4be4b

Please sign in to comment.