parser.addArgument("--config")
.help("Set the path, where to store the config (Default: $XDG_DATA_HOME/signal-cli , $HOME/.local/share/signal-cli).");
- parser.addArgument("-u", "--username").help("Specify your phone number, that will be used for verification.");
+ parser.addArgument("-u", "--username").help("Specify your phone number, that will be your identifier.");
var mut = parser.addMutuallyExclusiveGroup();
mut.addArgument("--dbus").help("Make request via user dbus.").action(Arguments.storeTrue());
.type(Arguments.enumStringType(OutputType.class))
.setDefault(OutputType.PLAIN_TEXT);
+ parser.addArgument("--service-environment")
+ .help("Choose the server environment to use, SANDBOX or LIVE.")
+ .type(Arguments.enumStringType(ServiceEnvironmentCli.class))
+ .setDefault(ServiceEnvironmentCli.LIVE);
+
var subparsers = parser.addSubparsers().title("subcommands").dest("command");
final var commands = Commands.getCommands();
throw new UserErrorException("Command not implemented!");
}
- OutputType outputType = ns.get("output");
+ var outputType = ns.<OutputType>get("output");
if (!command.getSupportedOutputTypes().contains(outputType)) {
throw new UserErrorException("Command doesn't support output type " + outputType.toString());
}
var username = ns.getString("username");
- final boolean useDbus = ns.getBoolean("dbus");
- final boolean useDbusSystem = ns.getBoolean("dbus_system");
+ final var useDbus = ns.getBoolean("dbus");
+ 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);
dataPath = getDefaultDataPath();
}
- final var serviceEnvironment = ServiceEnvironment.LIVE;
+ final var serviceEnvironmentCli = ns.<ServiceEnvironmentCli>get("service_environment");
+ final var serviceEnvironment = serviceEnvironmentCli == ServiceEnvironmentCli.LIVE
+ ? ServiceEnvironment.LIVE
+ : ServiceEnvironment.SANDBOX;
if (!ServiceConfig.getCapabilities().isGv2()) {
logger.warn("WARNING: Support for new group V2 is disabled,"