]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/commands/Commands.java
1f0fc2ec48bb92eb609e0899b5f26fa8f777b81f
[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 GetAttachmentCommand());
15 addCommand(new BlockCommand());
16 addCommand(new DaemonCommand());
17 addCommand(new DeleteLocalAccountDataCommand());
18 addCommand(new FinishLinkCommand());
19 addCommand(new GetUserStatusCommand());
20 addCommand(new JoinGroupCommand());
21 addCommand(new JsonRpcDispatcherCommand());
22 addCommand(new LinkCommand());
23 addCommand(new ListAccountsCommand());
24 addCommand(new ListContactsCommand());
25 addCommand(new ListDevicesCommand());
26 addCommand(new ListGroupsCommand());
27 addCommand(new ListIdentitiesCommand());
28 addCommand(new ListStickerPacksCommand());
29 addCommand(new QuitGroupCommand());
30 addCommand(new ReceiveCommand());
31 addCommand(new RegisterCommand());
32 addCommand(new RemoveContactCommand());
33 addCommand(new RemoveDeviceCommand());
34 addCommand(new RemovePinCommand());
35 addCommand(new RemoteDeleteCommand());
36 addCommand(new SendCommand());
37 addCommand(new SendContactsCommand());
38 addCommand(new SendPaymentNotificationCommand());
39 addCommand(new SendReactionCommand());
40 addCommand(new SendReceiptCommand());
41 addCommand(new SendSyncRequestCommand());
42 addCommand(new SendTypingCommand());
43 addCommand(new SetPinCommand());
44 addCommand(new SubmitRateLimitChallengeCommand());
45 addCommand(new StartLinkCommand());
46 addCommand(new TrustCommand());
47 addCommand(new UnblockCommand());
48 addCommand(new UnregisterCommand());
49 addCommand(new UpdateAccountCommand());
50 addCommand(new UpdateConfigurationCommand());
51 addCommand(new UpdateContactCommand());
52 addCommand(new UpdateGroupCommand());
53 addCommand(new UpdateProfileCommand());
54 addCommand(new UploadStickerPackCommand());
55 addCommand(new VerifyCommand());
56 addCommand(new VersionCommand());
57 }
58
59 public static Map<String, SubparserAttacher> getCommandSubparserAttachers() {
60 return commandSubparserAttacher;
61 }
62
63 public static Command getCommand(String commandKey) {
64 if (!commands.containsKey(commandKey)) {
65 return null;
66 }
67 return commands.get(commandKey);
68 }
69
70 private static void addCommand(Command command) {
71 commands.put(command.getName(), command);
72 if (command instanceof CliCommand) {
73 commandSubparserAttacher.put(command.getName(), ((CliCommand) command)::attachToSubparser);
74 }
75 }
76 }