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