lunes_cli/node/
exec.rs

1use std::process::Command;
2
3pub fn up() {
4    println!("Up Lunes Node");
5
6    match Command::new("systemclt")
7        .arg("start")
8        .arg("lunesnode.service")
9        .status()
10    {
11        Err(e) => panic!("Error starting Lunes Node, {:?}", e),
12        Ok(x) => x,
13    };
14}
15
16pub fn down() {
17    println!("Down lunes node");
18
19    match Command::new("systemclt")
20        .arg("stop")
21        .arg("lunesnode.service")
22        .status()
23    {
24        Err(e) => panic!("Error stopping Lunes Node, {:?}", e),
25        Ok(x) => x,
26    };
27}
28
29pub fn logs() {
30    println!("Show logs of lunes node");
31
32    match Command::new("journalctl")
33        .arg("-fu")
34        .arg("lunesnode")
35        .status()
36    {
37        Err(e) => panic!("Error show Lunes Node Logs, {:?}", e),
38        Ok(x) => x,
39    };
40}
41
42pub fn status() {
43    match Command::new("systemclt")
44        .arg("status")
45        .arg("lunesnode.service")
46        .status()
47    {
48        Err(e) => panic!("Error read status of Lunes Node, {:?}", e),
49        Ok(x) => x,
50    };
51}
52
53pub fn version() {
54    println!("version: 1.1.1")
55}
56
57pub fn config() {
58    println!("pass your config")
59}
60
61pub fn install(version: Option<String>) {
62    match version {
63        Some(v) => println!("Installing your lunes node version: {}", v),
64        None => println!("Installing your lunes node version: latest"),
65    }
66}