Store repo names and selected repo in state
This commit is contained in:
parent
427dce3e48
commit
3a3a2de8dc
4 changed files with 97 additions and 10 deletions
|
|
@ -9,12 +9,22 @@ pub struct Command {}
|
|||
impl Command {
|
||||
pub fn run(self, env: &Environment) -> anyhow::Result<()> {
|
||||
let data_dir = gdn::data::open(env.data_dir.clone())?;
|
||||
let state = gdn::data::load_state(&data_dir)?;
|
||||
|
||||
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"),
|
||||
println!();
|
||||
if state.repos.is_empty() {
|
||||
println!("No repos");
|
||||
} else {
|
||||
println!("Repos ({}):", state.repos.len());
|
||||
for (id, name) in &state.repos {
|
||||
if state.selected_repo == Some(*id) {
|
||||
println!("- {name} ({id}, selected)");
|
||||
} else {
|
||||
println!("- {name} ({id})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue