modcli/commands/
framework.rs

1use crate::command::Command;
2use crate::modcli_version;
3use crate::output::{build, print, BLUE, GREY, LIGHT_BLUE};
4pub struct FrameworkCommand;
5
6impl Command for FrameworkCommand {
7    /// Command name
8    fn name(&self) -> &'static str {
9        "framework"
10    }
11
12    // Command help
13    fn help(&self) -> Option<&str> {
14        Some("Framework Information")
15    }
16
17    // Command hidden
18    fn hidden(&self) -> bool {
19        true
20    }
21
22    // Command validate
23    fn validate(&self, args: &[String]) -> Result<(), String> {
24        if !args.is_empty() {
25            Err("framework does not accept any arguments.".into())
26        } else {
27            Ok(())
28        }
29    }
30
31    // Command execute
32    fn execute(&self, _args: &[String]) {
33        // Construct framework information
34        let framework = build()
35            .part("Mod")
36            .color(LIGHT_BLUE)
37            .bold()
38            .part("cli")
39            .color(BLUE)
40            .part(":")
41            .color(GREY)
42            .space()
43            .part("version:")
44            .space()
45            .part(modcli_version())
46            .bold()
47            .get();
48
49        // Construct framework description
50        let description = build()
51            .part("⬢")
52            .color(BLUE)
53            .space()
54            .part("cli framework for")
55            .italic()
56            .space()
57            .part("Rust")
58            .italic()
59            .bold()
60            .color(GREY)
61            .space()
62            .get();
63
64        print::newline();
65        print::line(&framework);
66        print::line(&description);
67        print::newline();
68    }
69}