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