1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use super::ble::Ble;
use super::chat::Chat;
use super::chatfile::ChatFile;
use super::connections::Connections;
use super::debug::Debug;
use super::dtn::Dtn;
use super::feed::Feed;
use super::group::Group;
use super::node::Node;
use super::router::Router;
use super::rtc::Rtc;
use super::user_accounts::UserAccounts;
use super::users::Users;
pub struct Cli {}
impl Cli {
pub fn process_command(command: String) {
match command {
cmd if cmd.starts_with("node ") => {
Node::cli(cmd.strip_prefix("node ").unwrap());
}
cmd if cmd.starts_with("account ") => {
UserAccounts::cli(cmd.strip_prefix("account ").unwrap());
}
cmd if cmd.starts_with("users ") => {
Users::cli(cmd.strip_prefix("users ").unwrap());
}
cmd if cmd.starts_with("router ") => {
Router::cli(cmd.strip_prefix("router ").unwrap());
}
cmd if cmd.starts_with("feed ") => {
Feed::cli(cmd.strip_prefix("feed ").unwrap());
}
cmd if cmd.starts_with("chat ") => {
Chat::cli(cmd.strip_prefix("chat ").unwrap());
}
cmd if cmd.starts_with("connections ") => {
Connections::cli(cmd.strip_prefix("connections ").unwrap());
}
cmd if cmd.starts_with("ble ") => {
Ble::cli(cmd.strip_prefix("ble ").unwrap());
}
cmd if cmd.starts_with("debug ") => {
Debug::cli(cmd.strip_prefix("debug ").unwrap());
}
cmd if cmd.starts_with("file ") => {
ChatFile::cli(cmd.strip_prefix("file ").unwrap());
}
cmd if cmd.starts_with("group ") => {
Group::cli(cmd.strip_prefix("group ").unwrap());
}
cmd if cmd.starts_with("rtc ") => {
Rtc::cli(cmd.strip_prefix("rtc ").unwrap());
}
cmd if cmd.starts_with("dtn ") => {
Dtn::cli(cmd.strip_prefix("dtn ").unwrap());
}
_ => log::error!("unknown command"),
}
}
}