Skip to main content

zoi_cli/cmd/
about.rs

1//! The about command displays information about Zoi.
2use colored::Colorize;
3
4use crate::utils;
5
6/// The description of the application.
7const DESCRIPTION: &str = "Zoi - Advanced Package Manager & Environment \
8                           Orchestrator.\n  Part of the Zillowe Development \
9                           Suite (ZDS)";
10/// The author of the application.
11const AUTHOR: &str = "Zusty < Zillowe Foundation";
12/// The homepage of the application.
13const HOMEPAGE: &str = "https://zillowe.qzz.io/zds/zoi";
14/// The documentation URL for the application.
15const DOCS: &str = "https://zillowe.qzz.io/docs/zds/zoi";
16/// The git repository URL for the application.
17const GITREPO: &str = "https://gitlab.com/zillowe/zillwen/zusty/zoi";
18/// The contact email for the application.
19const EMAIL: &str = "contact@zillowe.qzz.io";
20/// The license of the application.
21const LICENSE: &str = "Apache 2.0";
22
23/// Executes the about command.
24pub fn run(branch: &str, status: &str, number: &str, commit: &str) {
25    let full_version_string =
26        utils::format_version_full(branch, status, number, commit);
27
28    println!("\n  {}\n", DESCRIPTION.green());
29
30    println!("  {:<12}{}", "Version:".cyan(), full_version_string);
31    println!("  {:<12}{}", "Author:".cyan(), AUTHOR);
32    println!("  {:<12}{}", "Homepage:".cyan(), HOMEPAGE);
33    println!("  {:<12}{}", "Docs:".cyan(), DOCS);
34    println!("  {:<12}{}", "Email:".cyan(), EMAIL);
35    println!("  {:<12}{}", "GitLab:".cyan(), GITREPO);
36    println!("  {:<12}{}", "License:".cyan(), LICENSE);
37
38    let posthog_host = option_env!("POSTHOG_API_HOST");
39    let zoi_registry = option_env!("ZOI_DEFAULT_REGISTRY");
40    let about_packager_author = option_env!("ZOI_ABOUT_PACKAGER_AUTHOR");
41    let about_packager_email = option_env!("ZOI_ABOUT_PACKAGER_EMAIL");
42    let about_packager_homepage = option_env!("ZOI_ABOUT_PACKAGER_HOMEPAGE");
43
44    let has_build_info = posthog_host.is_some_and(|s| !s.is_empty())
45        || zoi_registry.is_some_and(|s| !s.is_empty());
46
47    if has_build_info {
48        println!("\n  {}", "Build Information".green());
49        if let Some(host) = posthog_host
50            && !host.is_empty()
51        {
52            println!("  {:<19}{}", "Telemetry Host:".cyan(), host);
53        }
54        if let Some(registry) = zoi_registry
55            && !registry.is_empty()
56        {
57            println!("  {:<19}{}", "Default Registry:".cyan(), registry);
58        }
59    }
60
61    let has_packager_info = about_packager_author
62        .is_some_and(|s| !s.is_empty())
63        || about_packager_email.is_some_and(|s| !s.is_empty())
64        || about_packager_homepage.is_some_and(|s| !s.is_empty());
65
66    if has_packager_info {
67        println!("\n  {}", "Packager Information".green());
68        if let Some(author) = about_packager_author
69            && !author.is_empty()
70        {
71            println!("  {:<19}{}", "Packager:".cyan(), author);
72        }
73        if let Some(email) = about_packager_email
74            && !email.is_empty()
75        {
76            println!("  {:<19}{}", "Email:".cyan(), email);
77        }
78        if let Some(homepage) = about_packager_homepage
79            && !homepage.is_empty()
80        {
81            println!("  {:<19}{}", "Homepage:".cyan(), homepage);
82        }
83    }
84
85    println!(
86        "\n  By continuing using Zoi, you agree to our Privacy Policy and \
87         Terms of Service."
88    );
89    println!(
90        "  Privacy Policy and Terms of Service can be found on our website."
91    );
92
93    println!();
94}