diff options
author | Bjørn Christian Seime <bjorncs@oath.com> | 2018-10-15 11:11:47 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@oath.com> | 2018-10-15 11:11:47 +0200 |
commit | ae2daa90050c1bd218e92b27e568a3de4e6c59a3 (patch) | |
tree | 8d1526956aa2601635dead41343053d7f743a6a4 /vespaclient-java/src/main/java/com/yahoo/vespaget | |
parent | ebad90033c69645616b644fc06e5e789507ecad0 (diff) |
Add --xmloutput to vespa-get + vespa-visit
Diffstat (limited to 'vespaclient-java/src/main/java/com/yahoo/vespaget')
-rw-r--r-- | vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java b/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java index 51138db8d00..76aaf283a16 100644 --- a/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java +++ b/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java @@ -37,6 +37,7 @@ public class CommandLineOptions { public static final String PRIORITY_OPTION = "priority"; public static final String LOADTYPE_OPTION = "loadtype"; public static final String JSONOUTPUT_OPTION = "jsonoutput"; + public static final String XMLOUTPUT_OPTION = "xmloutput"; private final Options options = createOptions(); private final InputStream stdIn; @@ -136,6 +137,11 @@ public class CommandLineOptions { .desc("JSON output") .longOpt(JSONOUTPUT_OPTION).build()); + options.addOption(Option.builder("x") + .hasArg(false) + .desc("XML output (default format)") + .longOpt(XMLOUTPUT_OPTION).build()); + return options; } @@ -165,11 +171,16 @@ public class CommandLineOptions { boolean noRetry = cl.hasOption(NORETRY_OPTION); boolean showDocSize = cl.hasOption(SHOWDOCSIZE_OPTION); boolean jsonOutput = cl.hasOption(JSONOUTPUT_OPTION); + boolean xmlOutput = cl.hasOption(XMLOUTPUT_OPTION); int trace = getTrace(cl); DocumentProtocol.Priority priority = getPriority(cl); double timeout = getTimeout(cl); Iterator<String> documentIds = getDocumentIds(cl); + if (jsonOutput && xmlOutput) { + throw new IllegalArgumentException("Cannot combine both xml and json output"); + } + if (printIdsOnly && headersOnly) { throw new IllegalArgumentException("Print ids and headers only options are mutually exclusive."); } @@ -216,7 +227,7 @@ public class CommandLineOptions { .setTraceLevel(trace) .setPriority(priority) .setTimeout(timeout) - .setJsonOutput(jsonOutput) + .setJsonOutput(!jsonOutput && !xmlOutput ? false : jsonOutput) // TODO Vespa 7 Change default to JSON .build(); } catch (ParseException pe) { throw new IllegalArgumentException(pe.getMessage()); |