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