]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/commands/Commands.java
Implement dbus support for listIdentities
[signal-cli] / src / main / java / org / asamk / signal / commands / Commands.java
1 package org.asamk.signal.commands;
2
3 import java.util.HashMap;
4 import java.util.Map;
5 import java.util.TreeMap;
6
7 public class Commands {
8
9 private static final Map<String, Command> commands = new HashMap<>();
10 private static final Map<String, SubparserAttacher> commandSubparserAttacher = new TreeMap<>();
11
12 static {
13 addCommand(new AddDeviceCommand());
14 addCommand(new BlockCommand());
15 addCommand(new DaemonCommand());
16 addCommand(new DeleteLocalAccountDataCommand());
17 addCommand(new FinishChangeNumberCommand());
18 addCommand(new FinishLinkCommand());
19 addCommand(new GetAttachmentCommand());
20 addCommand(new GetAvatarCommand());
21 addCommand(new GetStickerCommand());
22 addCommand(new GetUserStatusCommand());
23 addCommand(new AddStickerPackCommand());
24 addCommand(new JoinGroupCommand());
25 addCommand(new JsonRpcDispatcherCommand());
26 addCommand(new LinkCommand());
27 addCommand(new ListAccountsCommand());
28 addCommand(new ListContactsCommand());
29 addCommand(new ListDevicesCommand());
30 addCommand(new ListGroupsCommand());
31 addCommand(new ListIdentitiesCommand());
32 addCommand(new ListStickerPacksCommand());
33 addCommand(new QuitGroupCommand());
34 addCommand(new ReceiveCommand());
35 addCommand(new RegisterCommand());
36 addCommand(new RemoveContactCommand());
37 addCommand(new RemoveDeviceCommand());
38 addCommand(new RemovePinCommand());
39 addCommand(new RemoteDeleteCommand());
40 addCommand(new SendCommand());
41 addCommand(new SendContactsCommand());
42 addCommand(new SendMessageRequestResponseCommand());
43 addCommand(new SendPaymentNotificationCommand());
44 addCommand(new SendReactionCommand());
45 addCommand(new SendReceiptCommand());
46 addCommand(new SendSyncRequestCommand());
47 addCommand(new SendTypingCommand());
48 addCommand(new SetPinCommand());
49 addCommand(new SubmitRateLimitChallengeCommand());
50 addCommand(new StartChangeNumberCommand());
51 addCommand(new StartLinkCommand());
52 addCommand(new TrustCommand());
53 addCommand(new UnblockCommand());
54 addCommand(new UnregisterCommand());
55 addCommand(new UpdateAccountCommand());
56 addCommand(new UpdateConfigurationCommand());
57 addCommand(new UpdateContactCommand());
58 addCommand(new UpdateGroupCommand());
59 addCommand(new UpdateProfileCommand());
60 addCommand(new UploadStickerPackCommand());
61 addCommand(new VerifyCommand());
62 addCommand(new VersionCommand());
63 }
64
65 public static Map<String, SubparserAttacher> getCommandSubparserAttachers() {
66 return commandSubparserAttacher;
67 }
68
69 public static Command getCommand(String commandKey) {
70 if (!commands.containsKey(commandKey)) {
71 return null;
72 }
73 return commands.get(commandKey);
74 }
75
76 private static void addCommand(Command command) {
77 commands.put(command.getName(), command);
78 if (command instanceof CliCommand cliCommand) {
79 commandSubparserAttacher.put(command.getName(), cliCommand::attachToSubparser);
80 }
81 }
82 }