Add status cli command
This commit is contained in:
parent
1ed5e5d600
commit
427dce3e48
3 changed files with 26 additions and 1 deletions
22
gdn-cli/src/commands/status.rs
Normal file
22
gdn-cli/src/commands/status.rs
Normal 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(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue