Skip to content

Conversation

kim
Copy link
Contributor

@kim kim commented Oct 2, 2025

WIP

Comment on lines +78 to +99
pub fn print_database_tree_info(&self, mut out: impl io::Write) -> anyhow::Result<()> {
let fmt_names = |names: &BTreeSet<String>| match names.len() {
0 => <_>::default(),
1 => format!(": {}", names.first().unwrap()),
_ => format!(": {names:?}"),
};

let tree_info = &self.database_tree;

write!(out, "{}{}", tree_info.root.identity, fmt_names(&tree_info.root.names))?;
for (identity, info) in &tree_info.children {
let names = fmt_names(&info.names);
let parent = info
.parent
.map(|parent| format!(" (parent: {parent})"))
.unwrap_or_default();

write!(out, "{identity}{parent}{names}")?;
}

Ok(())
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aasoni I have been a little un-imaginative about how to render the tree of children when trying to delete a parent. Note also that a database can have more than one name.

If you have a specific idea of how this should be rendered, please let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe @bfops ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant