feat: can create root
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-05-10 22:47:32 +02:00
parent c54fc3f4d0
commit 442ab64583
5 changed files with 36 additions and 1 deletions

View File

@@ -39,7 +39,14 @@ pub async fn execute(state: State) -> Result<()> {
}
fn run(terminal: &mut Terminal<CrosstermBackend<Stdout>>, state: SharedState) -> Result<()> {
let root = "kjuulh".to_string();
let root = match state.querier.get_available_roots() {
// TODO: maybe present choose root screen
Some(roots) => roots.first().cloned().unwrap(),
None => {
// TODO: present create root screen
anyhow::bail!("no valid root available\nPlease run:\n\n$ hyperlog create-root --name <your-username>");
}
};
let mut graph_explorer = GraphExplorer::new(root.clone(), state.clone());
graph_explorer.update_graph()?;