aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-20 13:25:54 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-20 15:16:25 +0200
commitdc8df962d8f0d93595a4e036bb29bc3498abc35f (patch)
treedc0d45d7fe2d1e1a29b1b5d84e9e5c73ce72d51a /libqpdf/qpdf
parent907df2c823710319e53c0ba6583a1ede4ee5413d (diff)
downloadqpdf-dc8df962d8f0d93595a4e036bb29bc3498abc35f.tar.zst
Make version default to latest for --json-output (like --json)
Diffstat (limited to 'libqpdf/qpdf')
-rw-r--r--libqpdf/qpdf/auto_job_help.hh11
-rw-r--r--libqpdf/qpdf/auto_job_init.hh2
-rw-r--r--libqpdf/qpdf/auto_job_json_init.hh2
3 files changed, 8 insertions, 7 deletions
diff --git a/libqpdf/qpdf/auto_job_help.hh b/libqpdf/qpdf/auto_job_help.hh
index 7d88155b..e4bab551 100644
--- a/libqpdf/qpdf/auto_job_help.hh
+++ b/libqpdf/qpdf/auto_job_help.hh
@@ -795,8 +795,8 @@ ap.addOptionHelp("--json", "json", "show file in JSON format", R"(--json[=versio
Generate a JSON representation of the file. This is described in
depth in the JSON section of the manual. "version" may be a
-specific version or "latest". Run qpdf --json-help for a
-description of the generated JSON object.
+specific version or "latest" (the default). Run qpdf --json-help
+for a description of the generated JSON object.
)");
ap.addOptionHelp("--json-help", "json", "show format of JSON output", R"(Describe the format of the JSON output by writing to standard
output a JSON object with the same keys and with values
@@ -832,11 +832,12 @@ name as the prefix for stream data files. Whatever is given here
will be appended with -nnn to create the name of the file that
will contain the data for the stream stream in object nnn.
)");
-ap.addOptionHelp("--json-output", "json", "serialize to JSON", R"(--json-output=version
+ap.addOptionHelp("--json-output", "json", "serialize to JSON", R"(--json-output[=version]
The output file will be qpdf JSON format at the given version.
-Only version 2 is supported. See also --json-stream-data
-and --json-stream-prefix
+"version" may be a specific version or "latest" (the default).
+Version 1 is not supported. See also --json-stream-data
+and --json-stream-prefix.
)");
ap.addOptionHelp("--json-input", "json", "input file is qpdf JSON", R"(Treat the input file as a JSON file in qpdf JSON format as
written by qpdf --json-output. See the "QPDF JSON Format"
diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh
index f582c6ec..c76a0b6a 100644
--- a/libqpdf/qpdf/auto_job_init.hh
+++ b/libqpdf/qpdf/auto_job_init.hh
@@ -112,7 +112,6 @@ this->ap.addChoices("compress-streams", [this](std::string const& x){c_main->com
this->ap.addChoices("decode-level", [this](std::string const& x){c_main->decodeLevel(x);}, true, decode_level_choices);
this->ap.addChoices("flatten-annotations", [this](std::string const& x){c_main->flattenAnnotations(x);}, true, flatten_choices);
this->ap.addChoices("json-key", [this](std::string const& x){c_main->jsonKey(x);}, true, json_key_choices);
-this->ap.addChoices("json-output", [this](std::string const& x){c_main->jsonOutput(x);}, true, json_output_choices);
this->ap.addChoices("json-stream-data", [this](std::string const& x){c_main->jsonStreamData(x);}, true, json_stream_data_choices);
this->ap.addChoices("keep-files-open", [this](std::string const& x){c_main->keepFilesOpen(x);}, true, yn_choices);
this->ap.addChoices("normalize-content", [this](std::string const& x){c_main->normalizeContent(x);}, true, yn_choices);
@@ -121,6 +120,7 @@ this->ap.addChoices("password-mode", [this](std::string const& x){c_main->passwo
this->ap.addChoices("remove-unreferenced-resources", [this](std::string const& x){c_main->removeUnreferencedResources(x);}, true, remove_unref_choices);
this->ap.addChoices("stream-data", [this](std::string const& x){c_main->streamData(x);}, true, stream_data_choices);
this->ap.addChoices("json", [this](std::string const& x){c_main->json(x);}, false, json_version_choices);
+this->ap.addChoices("json-output", [this](std::string const& x){c_main->jsonOutput(x);}, false, json_output_choices);
this->ap.registerOptionTable("pages", b(&ArgParser::argEndPages));
this->ap.addPositional(p(&ArgParser::argPagesPositional));
this->ap.addRequiredParameter("password", p(&ArgParser::argPagesPassword), "password");
diff --git a/libqpdf/qpdf/auto_job_json_init.hh b/libqpdf/qpdf/auto_job_json_init.hh
index 125250e6..168d5676 100644
--- a/libqpdf/qpdf/auto_job_json_init.hh
+++ b/libqpdf/qpdf/auto_job_json_init.hh
@@ -107,7 +107,7 @@ pushKey("splitPages");
addParameter([this](std::string const& p) { c_main->splitPages(p); });
popHandler(); // key: splitPages
pushKey("jsonOutput");
-addChoices(json_output_choices, true, [this](std::string const& p) { c_main->jsonOutput(p); });
+addChoices(json_output_choices, false, [this](std::string const& p) { c_main->jsonOutput(p); });
popHandler(); // key: jsonOutput
pushKey("encrypt");
beginDict(bindJSON(&Handlers::beginEncrypt), bindBare(&Handlers::endEncrypt)); // .encrypt