Remove deprecated --json parameter

This commit is contained in:
AsamK 2021-08-08 10:44:23 +02:00
parent 54f7bc5d79
commit 17d00d6ca8
4 changed files with 7 additions and 40 deletions

View file

@ -1,6 +1,8 @@
# Changelog # Changelog
## [Unreleased] ## [Unreleased]
### Changed
- Removed deprecated `--json` parameter, use `--output=json` instead
## [0.8.5] - 2021-08-07 ## [0.8.5] - 2021-08-07
### Added ### Added

View file

@ -36,9 +36,6 @@ public class DaemonCommand implements MultiLocalCommand {
subparser.addArgument("--ignore-attachments") subparser.addArgument("--ignore-attachments")
.help("Dont download attachments of received messages.") .help("Dont download attachments of received messages.")
.action(Arguments.storeTrue()); .action(Arguments.storeTrue());
subparser.addArgument("--json")
.help("WARNING: This parameter is now deprecated! Please use the global \"--output=json\" option instead.\n\nOutput received messages in json format, one json object per line.")
.action(Arguments.storeTrue());
} }
@Override @Override
@ -48,12 +45,7 @@ public class DaemonCommand implements MultiLocalCommand {
@Override @Override
public void handleCommand(final Namespace ns, final Manager m) throws CommandException { public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
var inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json"); var inJson = ns.get("output") == OutputType.JSON;
// TODO delete later when "json" variable is removed
if (ns.getBoolean("json")) {
logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead.");
}
boolean ignoreAttachments = ns.getBoolean("ignore-attachments"); boolean ignoreAttachments = ns.getBoolean("ignore-attachments");
@ -82,12 +74,7 @@ public class DaemonCommand implements MultiLocalCommand {
@Override @Override
public void handleCommand(final Namespace ns, final List<Manager> managers) throws CommandException { public void handleCommand(final Namespace ns, final List<Manager> managers) throws CommandException {
var inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json"); var inJson = ns.get("output") == OutputType.JSON;
// TODO delete later when "json" variable is removed
if (ns.getBoolean("json")) {
logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead.");
}
boolean ignoreAttachments = ns.getBoolean("ignore-attachments"); boolean ignoreAttachments = ns.getBoolean("ignore-attachments");

View file

@ -1,6 +1,5 @@
package org.asamk.signal.commands; package org.asamk.signal.commands;
import net.sourceforge.argparse4j.impl.Arguments;
import net.sourceforge.argparse4j.inf.Namespace; import net.sourceforge.argparse4j.inf.Namespace;
import net.sourceforge.argparse4j.inf.Subparser; import net.sourceforge.argparse4j.inf.Subparser;
@ -27,9 +26,6 @@ public class GetUserStatusCommand implements LocalCommand {
public void attachToSubparser(final Subparser subparser) { public void attachToSubparser(final Subparser subparser) {
subparser.help("Check if the specified phone number/s have been registered"); subparser.help("Check if the specified phone number/s have been registered");
subparser.addArgument("number").help("Phone number").nargs("+"); subparser.addArgument("number").help("Phone number").nargs("+");
subparser.addArgument("--json")
.help("WARNING: This parameter is now deprecated! Please use the global \"--output=json\" option instead.\n\nOutput received messages in json format, one json object per line.")
.action(Arguments.storeTrue());
} }
@Override @Override
@ -40,12 +36,7 @@ public class GetUserStatusCommand implements LocalCommand {
@Override @Override
public void handleCommand(final Namespace ns, final Manager m) throws CommandException { public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
// Setup the json object mapper // Setup the json object mapper
var inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json"); var inJson = ns.get("output") == OutputType.JSON;
// TODO delete later when "json" variable is removed
if (ns.getBoolean("json")) {
logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead.");
}
// Get a map of registration statuses // Get a map of registration statuses
Map<String, Boolean> registered; Map<String, Boolean> registered;

View file

@ -41,9 +41,6 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
subparser.addArgument("--ignore-attachments") subparser.addArgument("--ignore-attachments")
.help("Dont download attachments of received messages.") .help("Dont download attachments of received messages.")
.action(Arguments.storeTrue()); .action(Arguments.storeTrue());
subparser.addArgument("--json")
.help("WARNING: This parameter is now deprecated! Please use the global \"--output=json\" option instead.\n\nOutput received messages in json format, one json object per line.")
.action(Arguments.storeTrue());
} }
@Override @Override
@ -54,12 +51,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
public void handleCommand( public void handleCommand(
final Namespace ns, final Signal signal, DBusConnection dbusconnection final Namespace ns, final Signal signal, DBusConnection dbusconnection
) throws CommandException { ) throws CommandException {
var inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json"); var inJson = ns.get("output") == OutputType.JSON;
// TODO delete later when "json" variable is removed
if (ns.getBoolean("json")) {
logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead.");
}
try { try {
if (inJson) { if (inJson) {
@ -143,12 +135,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
@Override @Override
public void handleCommand(final Namespace ns, final Manager m) throws CommandException { public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
var inJson = ns.get("output") == OutputType.JSON || ns.getBoolean("json"); var inJson = ns.get("output") == OutputType.JSON;
// TODO delete later when "json" variable is removed
if (ns.getBoolean("json")) {
logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead.");
}
double timeout = ns.getDouble("timeout"); double timeout = ns.getDouble("timeout");
var returnOnTimeout = true; var returnOnTimeout = true;