diff --git a/src/cli/convert_json_toml.cpp b/src/cli/convert_json_toml.cpp index b8e5bb4de6..c5187ebb89 100644 --- a/src/cli/convert_json_toml.cpp +++ b/src/cli/convert_json_toml.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include @@ -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: