vdev/commands/
info.rs

1use anyhow::Result;
2use clap::Args;
3
4use crate::testing::docker::CONTAINER_TOOL;
5use crate::{app, config, platform};
6
7/// Show `vdev` command configuration
8#[derive(Args, Debug)]
9#[command()]
10pub struct Cli {}
11
12impl Cli {
13    pub fn exec(self) -> Result<()> {
14        println!("Container tool:  {}", CONTAINER_TOOL.display());
15        println!("Data path:       {}", platform::data_dir().display());
16        println!("Repository:      {:?}", app::path());
17        println!("Shell:           {}", app::SHELL.display());
18
19        println!("\nConfig:");
20        match config::path() {
21            Ok(path) => {
22                println!("  Path:        {}", path.display());
23                match config::load() {
24                    Ok(config) => {
25                        println!("  Repository:  {:?}", config.repo);
26                    }
27                    Err(error) => println!("  Could not load: {error}"),
28                }
29            }
30            Err(error) => println!("  Path:  Not found: {error}"),
31        }
32
33        println!("\nPlatform:");
34        println!("  Default target:  {}", platform::default_target());
35        Ok(())
36    }
37}