Improve command line help

Fixes #450
This commit is contained in:
AsamK 2021-05-20 20:54:11 +02:00
parent ab40344567
commit b8a0901fbd
27 changed files with 38 additions and 15 deletions

View file

@ -135,14 +135,14 @@ You will need the full uri enclosed in quotation marks, such as "tsdevice:/?uuid
=== listDevices
Show a list of connected devices.
Show a list of linked devices.
=== removeDevice
Remove a connected device.
Remove a linked device.
Only works, if this is the master device.
*-d* DEVICEID, *--device-id* DEVICEID::
*-d* DEVICE_ID, *--device-id* DEVICE_ID::
Specify the device you want to remove.
Use listDevices to see the deviceIds.
@ -293,6 +293,10 @@ In json mode this is outputted as an list of objects and is always in detailed m
*-d*, *--detailed*::
Include the list of members of each group and the group invite link.
=== listContacts
Show a list of known contacts with names.
=== listIdentities
List all known identity keys and their trust status, fingerprint and safety number.
@ -447,6 +451,9 @@ signal-cli -u USERNAME updateGroup -n "Group name" -m [MEMBER [MEMBER ...]]
Add member to a group::
signal-cli -u USERNAME updateGroup -g GROUP_ID -m "NEW_MEMBER"
Accept a group invitation::
signal-cli -u USERNAME updateGroup -g GROUP_ID
Leave a group::
signal-cli -u USERNAME quitGroup -g GROUP_ID

View file

@ -70,7 +70,7 @@ public class App {
.setDefault(OutputType.PLAIN_TEXT);
parser.addArgument("--service-environment")
.help("Choose the server environment to use, SANDBOX or LIVE.")
.help("Choose the server environment to use.")
.type(Arguments.enumStringType(ServiceEnvironmentCli.class))
.setDefault(ServiceEnvironmentCli.LIVE);

View file

@ -22,6 +22,7 @@ public class AddDeviceCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Link another device to this device. Only works, if this is the master device.");
subparser.addArgument("--uri")
.required(true)
.help("Specify the uri contained in the QR code shown by the new device.");

View file

@ -20,9 +20,9 @@ public class BlockCommand implements LocalCommand {
@Override
public 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.help("Block the given contacts or groups (no messages will be received)");
}
@Override

View file

@ -1,11 +1,11 @@
package org.asamk.signal.commands;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
public class Commands {
private static final Map<String, Command> commands = new HashMap<>();
private static final Map<String, Command> commands = new TreeMap<>();
static {
addCommand("addDevice", new AddDeviceCommand());

View file

@ -29,6 +29,7 @@ public class DaemonCommand implements MultiLocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Run in daemon mode and provide an experimental dbus interface.");
subparser.addArgument("--system")
.action(Arguments.storeTrue())
.help("Use DBus system bus instead of user bus.");

View file

@ -25,8 +25,8 @@ public class GetUserStatusCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.addArgument("number").help("Phone number").nargs("+");
subparser.help("Check if the specified phone number/s have been registered");
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());

View file

@ -22,6 +22,7 @@ public class JoinGroupCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Join a group via an invitation link.");
subparser.addArgument("--uri").required(true).help("Specify the uri with the group invitation link.");
}

View file

@ -21,6 +21,7 @@ public class LinkCommand implements ProvisioningCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Link to an existing device, instead of registering a new number.");
subparser.addArgument("-n", "--name").help("Specify a name to describe this new device.");
}

View file

@ -12,6 +12,7 @@ public class ListContactsCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Show a list of known contacts with names.");
}
@Override

View file

@ -21,6 +21,7 @@ public class ListDevicesCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Show a list of linked devices.");
}
@Override

View file

@ -60,11 +60,10 @@ public class ListGroupsCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("List group information including names, ids, active status, blocked status and members");
subparser.addArgument("-d", "--detailed")
.action(Arguments.storeTrue())
.help("List the members and group invite links of each group. If output=json, then this is always set");
subparser.help("List group information including names, ids, active status, blocked status and members");
}
@Override

View file

@ -35,6 +35,7 @@ public class ListIdentitiesCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("List all known identity keys and their trust status, fingerprint and safety number.");
subparser.addArgument("-n", "--number").help("Only show identity keys for the given phone number.");
}

View file

@ -26,6 +26,7 @@ public class QuitGroupCommand implements LocalCommand {
@Override
public 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("--admin")
.nargs("*")

View file

@ -33,6 +33,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Query the server for new messages.");
subparser.addArgument("-t", "--timeout")
.type(double.class)
.setDefault(3.0)

View file

@ -16,8 +16,9 @@ public class RegisterCommand implements RegistrationCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Register a phone number with SMS or voice verification.");
subparser.addArgument("-v", "--voice")
.help("The verification should be done over voice, not sms.")
.help("The verification should be done over voice, not SMS.")
.action(Arguments.storeTrue());
subparser.addArgument("--captcha")
.help("The captcha token, required if registration failed with a captcha required error.");

View file

@ -13,6 +13,7 @@ public class RemoveDeviceCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Remove a linked device.");
subparser.addArgument("-d", "--device-id", "--deviceId")
.type(int.class)
.required(true)

View file

@ -16,6 +16,7 @@ public class RemovePinCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Remove the registration lock pin.");
}
@Override

View file

@ -28,6 +28,7 @@ public class SendCommand implements DbusCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
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.");

View file

@ -16,6 +16,7 @@ public class SetPinCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Set a registration lock pin, to prevent others from registering this number.");
subparser.addArgument("registrationLockPin")
.help("The registration lock PIN, that will be required for new registrations (resets after 7 days of inactivity)");
}

View file

@ -16,6 +16,7 @@ public class TrustCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Set the trust level of a given number.");
subparser.addArgument("number").help("Specify the phone number, for which to set the trust.").required(true);
var mutTrust = subparser.addMutuallyExclusiveGroup();
mutTrust.addArgument("-a", "--trust-all-known-keys")

View file

@ -20,9 +20,9 @@ public class UnblockCommand implements LocalCommand {
@Override
public 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.help("Unblock the given contacts or groups (messages will be received again)");
}
@Override

View file

@ -16,13 +16,13 @@ public class UpdateContactCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Update the details of a given contact");
subparser.addArgument("number").help("Contact number");
subparser.addArgument("-n", "--name").required(true).help("New contact name");
subparser.addArgument("-e", "--expiration")
.required(false)
.type(int.class)
.help("Set expiration time of messages (seconds)");
subparser.help("Update the details of a given contact");
}
@Override

View file

@ -36,6 +36,7 @@ public class UpdateGroupCommand implements DbusCommand, LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Create or update a group.");
subparser.addArgument("-g", "--group").help("Specify the recipient group ID.");
subparser.addArgument("-n", "--name").help("Specify the new group name.");
subparser.addArgument("-d", "--description").help("Specify the new group description.");

View file

@ -16,6 +16,7 @@ public class UpdateProfileCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Set a name, about and avatar image for the user profile");
subparser.addArgument("--given-name", "--name").help("New profile (given) name");
subparser.addArgument("--family-name").help("New profile family name (optional)");
subparser.addArgument("--about").help("New profile about text");
@ -24,8 +25,6 @@ public class UpdateProfileCommand implements LocalCommand {
final var avatarOptions = subparser.addMutuallyExclusiveGroup();
avatarOptions.addArgument("--avatar").help("Path to new profile avatar");
avatarOptions.addArgument("--remove-avatar").action(Arguments.storeTrue());
subparser.help("Set a name, about and avatar image for the user profile");
}
@Override

View file

@ -21,6 +21,7 @@ public class UploadStickerPackCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Upload a new sticker pack, consisting of a manifest file and the stickers images.");
subparser.addArgument("path")
.help("The path of the manifest.json or a zip file containing the sticker pack you wish to upload.");
}

View file

@ -18,6 +18,7 @@ public class VerifyCommand implements RegistrationCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Verify the number using the code received via SMS or voice.");
subparser.addArgument("verificationCode").help("The verification code you received via sms or voice call.");
subparser.addArgument("-p", "--pin").help("The registration lock PIN, that was set by the user (Optional)");
}