]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/commands/Commands.java
1 package org
.asamk
.signal
.commands
;
3 import java
.util
.HashMap
;
5 import java
.util
.TreeMap
;
7 public class Commands
{
9 private static final Map
<String
, Command
> commands
= new HashMap
<>();
10 private static final Map
<String
, SubparserAttacher
> commandSubparserAttacher
= new TreeMap
<>();
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 ListContactsCommand());
21 addCommand(new ListDevicesCommand());
22 addCommand(new ListGroupsCommand());
23 addCommand(new ListIdentitiesCommand());
24 addCommand(new QuitGroupCommand());
25 addCommand(new ReceiveCommand());
26 addCommand(new RegisterCommand());
27 addCommand(new RemoveDeviceCommand());
28 addCommand(new RemoteDeleteCommand());
29 addCommand(new RemovePinCommand());
30 addCommand(new SendCommand());
31 addCommand(new SendContactsCommand());
32 addCommand(new SendReactionCommand());
33 addCommand(new SendSyncRequestCommand());
34 addCommand(new SendTypingCommand());
35 addCommand(new SetPinCommand());
36 addCommand(new TrustCommand());
37 addCommand(new UnblockCommand());
38 addCommand(new UnregisterCommand());
39 addCommand(new UpdateAccountCommand());
40 addCommand(new UpdateContactCommand());
41 addCommand(new UpdateGroupCommand());
42 addCommand(new UpdateProfileCommand());
43 addCommand(new UploadStickerPackCommand());
44 addCommand(new VerifyCommand());
45 addCommand(new VersionCommand());
48 public static Map
<String
, SubparserAttacher
> getCommandSubparserAttachers() {
49 return commandSubparserAttacher
;
52 public static Command
getCommand(String commandKey
) {
53 if (!commands
.containsKey(commandKey
)) {
56 return commands
.get(commandKey
);
59 private static void addCommand(Command command
) {
60 commands
.put(command
.getName(), command
);
61 if (command
instanceof CliCommand
) {
62 commandSubparserAttacher
.put(command
.getName(), ((CliCommand
) command
)::attachToSubparser
);