modcli/commands/
framework.rs

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