Update argparse4j
This commit is contained in:
		
							parent
							
								
									06e9f8ba64
								
							
						
					
					
						commit
						8e8eed7b06
					
				@ -23,7 +23,7 @@ repositories {
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
    implementation("org.bouncycastle:bcprov-jdk15on:1.68")
 | 
			
		||||
    implementation("net.sourceforge.argparse4j:argparse4j:0.8.1")
 | 
			
		||||
    implementation("net.sourceforge.argparse4j:argparse4j:0.9.0")
 | 
			
		||||
    implementation("com.github.hypfvieh:dbus-java:3.3.0")
 | 
			
		||||
    implementation("org.slf4j:slf4j-simple:1.7.30")
 | 
			
		||||
    implementation(project(":lib"))
 | 
			
		||||
 | 
			
		||||
@ -35,6 +35,8 @@ import java.io.IOException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static net.sourceforge.argparse4j.DefaultSettings.VERSION_0_9_0_DEFAULT_SETTINGS;
 | 
			
		||||
 | 
			
		||||
public class App {
 | 
			
		||||
 | 
			
		||||
    private final static Logger logger = LoggerFactory.getLogger(App.class);
 | 
			
		||||
@ -42,7 +44,8 @@ public class App {
 | 
			
		||||
    private final Namespace ns;
 | 
			
		||||
 | 
			
		||||
    static ArgumentParser buildArgumentParser() {
 | 
			
		||||
        var parser = ArgumentParsers.newFor("signal-cli")
 | 
			
		||||
        var parser = ArgumentParsers.newFor("signal-cli", VERSION_0_9_0_DEFAULT_SETTINGS)
 | 
			
		||||
                .includeArgumentNamesAsKeysInResult(true)
 | 
			
		||||
                .build()
 | 
			
		||||
                .defaultHelp(true)
 | 
			
		||||
                .description("Commandline interface for Signal.")
 | 
			
		||||
@ -101,7 +104,7 @@ public class App {
 | 
			
		||||
        var username = ns.getString("username");
 | 
			
		||||
 | 
			
		||||
        final var useDbus = ns.getBoolean("dbus");
 | 
			
		||||
        final var useDbusSystem = ns.getBoolean("dbus_system");
 | 
			
		||||
        final var useDbusSystem = ns.getBoolean("dbus-system");
 | 
			
		||||
        if (useDbus || useDbusSystem) {
 | 
			
		||||
            // If username is null, it will connect to the default object path
 | 
			
		||||
            initDbusClient(command, username, useDbusSystem);
 | 
			
		||||
@ -116,7 +119,7 @@ public class App {
 | 
			
		||||
            dataPath = getDefaultDataPath();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        final var serviceEnvironmentCli = ns.<ServiceEnvironmentCli>get("service_environment");
 | 
			
		||||
        final var serviceEnvironmentCli = ns.<ServiceEnvironmentCli>get("service-environment");
 | 
			
		||||
        final var serviceEnvironment = serviceEnvironmentCli == ServiceEnvironmentCli.LIVE
 | 
			
		||||
                ? ServiceEnvironment.LIVE
 | 
			
		||||
                : ServiceEnvironment.SANDBOX;
 | 
			
		||||
 | 
			
		||||
@ -54,7 +54,7 @@ public class DaemonCommand implements MultiLocalCommand {
 | 
			
		||||
            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");
 | 
			
		||||
 | 
			
		||||
        DBusConnection.DBusBusType busType;
 | 
			
		||||
        if (ns.getBoolean("system")) {
 | 
			
		||||
@ -88,7 +88,7 @@ public class DaemonCommand implements MultiLocalCommand {
 | 
			
		||||
            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");
 | 
			
		||||
 | 
			
		||||
        DBusConnection.DBusBusType busType;
 | 
			
		||||
        if (ns.getBoolean("system")) {
 | 
			
		||||
 | 
			
		||||
@ -155,7 +155,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
 | 
			
		||||
            returnOnTimeout = false;
 | 
			
		||||
            timeout = 3600;
 | 
			
		||||
        }
 | 
			
		||||
        boolean ignoreAttachments = ns.getBoolean("ignore_attachments");
 | 
			
		||||
        boolean ignoreAttachments = ns.getBoolean("ignore-attachments");
 | 
			
		||||
        try {
 | 
			
		||||
            final var handler = inJson ? new JsonReceiveMessageHandler(m) : new ReceiveMessageHandler(m);
 | 
			
		||||
            m.receiveMessages((long) (timeout * 1000),
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ public class RemoteDeleteCommand implements DbusCommand {
 | 
			
		||||
            throw new UserErrorException("You cannot specify recipients by phone number and groups at the same time");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        final long targetTimestamp = ns.getLong("target_timestamp");
 | 
			
		||||
        final long targetTimestamp = ns.getLong("target-timestamp");
 | 
			
		||||
 | 
			
		||||
        final var writer = new PlainTextWriterImpl(System.out);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -47,7 +47,7 @@ public class SendCommand implements DbusCommand {
 | 
			
		||||
        final List<String> recipients = ns.getList("recipient");
 | 
			
		||||
        final var isEndSession = ns.getBoolean("endsession");
 | 
			
		||||
        final var groupIdString = ns.getString("group");
 | 
			
		||||
        final var isNoteToSelf = ns.getBoolean("note_to_self");
 | 
			
		||||
        final var isNoteToSelf = ns.getBoolean("note-to-self");
 | 
			
		||||
 | 
			
		||||
        final var noRecipients = recipients == null || recipients.isEmpty();
 | 
			
		||||
        if ((noRecipients && isEndSession) || (noRecipients && groupIdString == null && !isNoteToSelf)) {
 | 
			
		||||
 | 
			
		||||
@ -51,8 +51,8 @@ public class SendReactionCommand implements DbusCommand {
 | 
			
		||||
 | 
			
		||||
        final var emoji = ns.getString("emoji");
 | 
			
		||||
        final boolean isRemove = ns.getBoolean("remove");
 | 
			
		||||
        final var targetAuthor = ns.getString("target_author");
 | 
			
		||||
        final long targetTimestamp = ns.getLong("target_timestamp");
 | 
			
		||||
        final var targetAuthor = ns.getString("target-author");
 | 
			
		||||
        final long targetTimestamp = ns.getLong("target-timestamp");
 | 
			
		||||
 | 
			
		||||
        final var writer = new PlainTextWriterImpl(System.out);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,7 @@ public class TrustCommand implements LocalCommand {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
 | 
			
		||||
        var number = ns.getString("number");
 | 
			
		||||
        if (ns.getBoolean("trust_all_known_keys")) {
 | 
			
		||||
        if (ns.getBoolean("trust-all-known-keys")) {
 | 
			
		||||
            boolean res;
 | 
			
		||||
            try {
 | 
			
		||||
                res = m.trustIdentityAllKeys(number);
 | 
			
		||||
@ -39,7 +39,7 @@ public class TrustCommand implements LocalCommand {
 | 
			
		||||
                throw new UserErrorException("Failed to set the trust for this number, make sure the number is correct.");
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            var safetyNumber = ns.getString("verified_safety_number");
 | 
			
		||||
            var safetyNumber = ns.getString("verified-safety-number");
 | 
			
		||||
            if (safetyNumber != null) {
 | 
			
		||||
                safetyNumber = safetyNumber.replaceAll(" ", "");
 | 
			
		||||
                if (safetyNumber.length() == 66) {
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ public class UnregisterCommand implements LocalCommand {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
 | 
			
		||||
        try {
 | 
			
		||||
            if (ns.getBoolean("delete_account")) {
 | 
			
		||||
            if (ns.getBoolean("delete-account")) {
 | 
			
		||||
                m.deleteAccount();
 | 
			
		||||
            } else {
 | 
			
		||||
                m.unregister();
 | 
			
		||||
 | 
			
		||||
@ -30,12 +30,12 @@ public class UpdateProfileCommand implements LocalCommand {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
 | 
			
		||||
        var givenName = ns.getString("given_name");
 | 
			
		||||
        var familyName = ns.getString("family_name");
 | 
			
		||||
        var givenName = ns.getString("given-name");
 | 
			
		||||
        var familyName = ns.getString("family-name");
 | 
			
		||||
        var about = ns.getString("about");
 | 
			
		||||
        var aboutEmoji = ns.getString("about_emoji");
 | 
			
		||||
        var aboutEmoji = ns.getString("about-emoji");
 | 
			
		||||
        var avatarPath = ns.getString("avatar");
 | 
			
		||||
        boolean removeAvatar = ns.getBoolean("remove_avatar");
 | 
			
		||||
        boolean removeAvatar = ns.getBoolean("remove-avatar");
 | 
			
		||||
 | 
			
		||||
        Optional<File> avatarFile = removeAvatar
 | 
			
		||||
                ? Optional.absent()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user