Add status cli command

This commit is contained in:
Joscha 2025-04-28 12:49:32 +02:00
parent 1ed5e5d600
commit 427dce3e48
3 changed files with 26 additions and 1 deletions

View file

@ -0,0 +1,22 @@
use clap::Parser;
use crate::Environment;
/// Display current status.
#[derive(Debug, Parser)]
pub struct Command {}
impl Command {
pub fn run(self, env: &Environment) -> anyhow::Result<()> {
let data_dir = gdn::data::open(env.data_dir.clone())?;
println!("Data dir version: {}", gdn::data::VERSION);
let state = gdn::data::load_state(&data_dir)?;
match state.name {
Some(name) => println!("Name: {name}"),
None => println!("No name"),
}
Ok(())
}
}