Replace --group parameter with --group-id

This commit is contained in:
AsamK 2021-08-10 14:33:51 +02:00
parent 15e8029715
commit 6c00054407
9 changed files with 28 additions and 28 deletions

View file

@ -162,7 +162,7 @@ Send a message to another user or group.
RECIPIENT::
Specify the recipients phone number.
*-g* GROUP, *--group* GROUP::
*-g* GROUP, *--group-id* GROUP::
Specify the recipient group ID in base64 encoding.
*-m* MESSAGE, *--message* MESSAGE::
@ -184,7 +184,7 @@ Send reaction to a previously received or sent message.
RECIPIENT::
Specify the recipients phone number.
*-g* GROUP, *--group* GROUP::
*-g* GROUP, *--group-id* GROUP::
Specify the recipient group ID in base64 encoding.
*-e* EMOJI, *--emoji* EMOJI::
@ -207,7 +207,7 @@ Indicator will be shown for 15seconds unless a typing STOP message is sent first
RECIPIENT::
Specify the recipients phone number.
*-g* GROUP, *--group* GROUP::
*-g* GROUP, *--group-id* GROUP::
Specify the recipient group ID in base64 encoding.
*-s*, *--stop*::
@ -220,7 +220,7 @@ Remotely delete a previously sent message.
RECIPIENT::
Specify the recipients phone number.
*-g* GROUP, *--group* GROUP::
*-g* GROUP, *--group-id* GROUP::
Specify the recipient group ID in base64 encoding.
*-t* TIMESTAMP, *--target-timestamp* TIMESTAMP::
@ -250,7 +250,7 @@ The invitation link URI (starts with `https://signal.group/#`)
Create or update a group.
If the user is a pending member, this command will accept the group invitation.
*-g* GROUP, *--group* GROUP::
*-g* GROUP, *--group-id* GROUP::
Specify the recipient group ID in base64 encoding.
If not specified, a new group with a new random ID is generated.
@ -296,7 +296,7 @@ To disable expiration set expiration time to 0.
Send a quit group message to all group members and remove self from member list.
If the user is a pending member, this command will decline the group invitation.
*-g* GROUP, *--group* GROUP::
*-g* GROUP, *--group-id* GROUP::
Specify the recipient group ID in base64 encoding.
*--delete*::
@ -385,7 +385,7 @@ This change is only local but can be synchronized to other devices by using `sen
[CONTACT [CONTACT ...]]::
Specify the phone numbers of contacts that should be blocked.
*-g* [GROUP [GROUP ...]], *--group* [GROUP [GROUP ...]]::
*-g* [GROUP [GROUP ...]], *--group-id* [GROUP [GROUP ...]]::
Specify the group IDs that should be blocked in base64 encoding.
=== unblock
@ -396,7 +396,7 @@ This change is only local but can be synchronized to other devices by using `sen
[CONTACT [CONTACT ...]]::
Specify the phone numbers of contacts that should be unblocked.
*-g* [GROUP [GROUP ...]], *--group* [GROUP [GROUP ...]]::
*-g* [GROUP [GROUP ...]], *--group-id* [GROUP [GROUP ...]]::
Specify the group IDs that should be unblocked in base64 encoding.
=== sendContacts

View file

@ -22,7 +22,7 @@ public class BlockCommand implements LocalCommand {
public static void attachToSubparser(final Subparser subparser) {
subparser.help("Block the given contacts or groups (no messages will be received)");
subparser.addArgument("contact").help("Contact number").nargs("*");
subparser.addArgument("-g", "--group").help("Group ID").nargs("*");
subparser.addArgument("-g", "--group-id", "--group").help("Group ID").nargs("*");
}
public BlockCommand(final OutputWriter outputWriter) {
@ -40,8 +40,8 @@ public class BlockCommand implements LocalCommand {
}
}
if (ns.<String>getList("group") != null) {
for (var groupIdString : ns.<String>getList("group")) {
if (ns.<String>getList("group-id") != null) {
for (var groupIdString : ns.<String>getList("group-id")) {
try {
var groupId = Util.decodeGroupId(groupIdString);
m.setGroupBlocked(groupId, true);

View file

@ -37,7 +37,7 @@ public class QuitGroupCommand implements LocalCommand {
public static void attachToSubparser(final Subparser subparser) {
subparser.help("Send a quit group message to all group members and remove self from member list.");
subparser.addArgument("-g", "--group").required(true).help("Specify the recipient group ID.");
subparser.addArgument("-g", "--group-id", "--group").required(true).help("Specify the recipient group ID.");
subparser.addArgument("--delete")
.action(Arguments.storeTrue())
.help("Delete local group data completely after quitting group.");
@ -52,7 +52,7 @@ public class QuitGroupCommand implements LocalCommand {
final GroupId groupId;
try {
groupId = Util.decodeGroupId(ns.getString("group"));
groupId = Util.decodeGroupId(ns.getString("group-id"));
} catch (GroupIdFormatException e) {
throw new UserErrorException("Invalid group id: " + e.getMessage());
}

View file

@ -30,14 +30,14 @@ public class RemoteDeleteCommand implements DbusCommand {
.required(true)
.type(long.class)
.help("Specify the timestamp of the message to delete.");
subparser.addArgument("-g", "--group").help("Specify the recipient group ID.");
subparser.addArgument("-g", "--group-id", "--group").help("Specify the recipient group ID.");
subparser.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*");
}
@Override
public void handleCommand(final Namespace ns, final Signal signal) throws CommandException {
final List<String> recipients = ns.getList("recipient");
final var groupIdString = ns.getString("group");
final var groupIdString = ns.getString("group-id");
final var noRecipients = recipients == null || recipients.isEmpty();
if (noRecipients && groupIdString == null) {

View file

@ -36,7 +36,7 @@ public class SendCommand implements DbusCommand {
subparser.help("Send a message to another user or group.");
subparser.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*");
final var mutuallyExclusiveGroup = subparser.addMutuallyExclusiveGroup();
mutuallyExclusiveGroup.addArgument("-g", "--group").help("Specify the recipient group ID.");
mutuallyExclusiveGroup.addArgument("-g", "--group-id", "--group").help("Specify the recipient group ID.");
mutuallyExclusiveGroup.addArgument("--note-to-self")
.help("Send the message to self without notification.")
.action(Arguments.storeTrue());
@ -52,7 +52,7 @@ public class SendCommand implements DbusCommand {
public void handleCommand(final Namespace ns, final Signal signal) throws CommandException {
final List<String> recipients = ns.getList("recipient");
final var isEndSession = ns.getBoolean("end-session");
final var groupIdString = ns.getString("group");
final var groupIdString = ns.getString("group-id");
final var isNoteToSelf = ns.getBoolean("note-to-self");
final var noRecipients = recipients == null || recipients.isEmpty();

View file

@ -27,7 +27,7 @@ public class SendReactionCommand implements DbusCommand {
public static void attachToSubparser(final Subparser subparser) {
subparser.help("Send reaction to a previously received or sent message.");
subparser.addArgument("-g", "--group").help("Specify the recipient group ID.");
subparser.addArgument("-g", "--group-id", "--group").help("Specify the recipient group ID.");
subparser.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*");
subparser.addArgument("-e", "--emoji")
.required(true)
@ -45,7 +45,7 @@ public class SendReactionCommand implements DbusCommand {
@Override
public void handleCommand(final Namespace ns, final Signal signal) throws CommandException {
final List<String> recipients = ns.getList("recipient");
final var groupIdString = ns.getString("group");
final var groupIdString = ns.getString("group-id");
final var noRecipients = recipients == null || recipients.isEmpty();
if (noRecipients && groupIdString == null) {

View file

@ -28,7 +28,7 @@ public class SendTypingCommand implements LocalCommand {
public static void attachToSubparser(final Subparser subparser) {
subparser.help(
"Send typing message to trigger a typing indicator for the recipient. Indicator will be shown for 15seconds unless a typing STOP message is sent first.");
subparser.addArgument("-g", "--group").help("Specify the recipient group ID.");
subparser.addArgument("-g", "--group-id", "--group").help("Specify the recipient group ID.");
subparser.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*");
subparser.addArgument("-s", "--stop").help("Send a typing STOP message.").action(Arguments.storeTrue());
}
@ -36,7 +36,7 @@ public class SendTypingCommand implements LocalCommand {
@Override
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
final var recipients = ns.<String>getList("recipient");
final var groupIdString = ns.getString("group");
final var groupIdString = ns.getString("group-id");
final var noRecipients = recipients == null || recipients.isEmpty();
if (noRecipients && groupIdString == null) {

View file

@ -25,7 +25,7 @@ public class UnblockCommand implements LocalCommand {
public static void attachToSubparser(final Subparser subparser) {
subparser.help("Unblock the given contacts or groups (messages will be received again)");
subparser.addArgument("contact").help("Contact number").nargs("*");
subparser.addArgument("-g", "--group").help("Group ID").nargs("*");
subparser.addArgument("-g", "--group-id", "--group").help("Group ID").nargs("*");
}
@Override
@ -40,8 +40,8 @@ public class UnblockCommand implements LocalCommand {
}
}
if (ns.<String>getList("group") != null) {
for (var groupIdString : ns.<String>getList("group")) {
if (ns.<String>getList("group-id") != null) {
for (var groupIdString : ns.<String>getList("group-id")) {
try {
var groupId = Util.decodeGroupId(groupIdString);
m.setGroupBlocked(groupId, false);

View file

@ -42,7 +42,7 @@ public class UpdateGroupCommand implements DbusCommand, LocalCommand {
public static void attachToSubparser(final Subparser subparser) {
subparser.help("Create or update a group.");
subparser.addArgument("-g", "--group").help("Specify the recipient group ID.");
subparser.addArgument("-g", "--group-id", "--group").help("Specify the group ID.");
subparser.addArgument("-n", "--name").help("Specify the new group name.");
subparser.addArgument("-d", "--description").help("Specify the new group description.");
subparser.addArgument("-a", "--avatar").help("Specify a new group avatar image file");
@ -76,7 +76,7 @@ public class UpdateGroupCommand implements DbusCommand, LocalCommand {
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
final var writer = (PlainTextWriter) outputWriter;
GroupId groupId = null;
final var groupIdString = ns.getString("group");
final var groupIdString = ns.getString("group-id");
if (groupIdString != null) {
try {
groupId = Util.decodeGroupId(groupIdString);
@ -144,9 +144,9 @@ public class UpdateGroupCommand implements DbusCommand, LocalCommand {
public void handleCommand(final Namespace ns, final Signal signal) throws CommandException {
final var writer = (PlainTextWriter) outputWriter;
byte[] groupId = null;
if (ns.getString("group") != null) {
if (ns.getString("group-id") != null) {
try {
groupId = Util.decodeGroupId(ns.getString("group")).serialize();
groupId = Util.decodeGroupId(ns.getString("group-id")).serialize();
} catch (GroupIdFormatException e) {
throw new UserErrorException("Invalid group id: " + e.getMessage());
}