feat: add create section
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-09 18:00:25 +02:00
parent 0406fbe14d
commit 105ab41f19
3 changed files with 30 additions and 21 deletions

View File

@@ -36,6 +36,8 @@ impl<'a> GraphExplorer<'a> {
}
pub fn update_graph(&mut self) -> Result<&mut Self> {
let now = std::time::SystemTime::now();
let graph = self
.state
.querier
@@ -50,6 +52,9 @@ impl<'a> GraphExplorer<'a> {
self.inner.graph = Some(graph);
let elapsed = now.elapsed()?;
tracing::trace!("Graph.update_graph took: {}nanos", elapsed.as_nanos());
Ok(self)
}
@@ -141,10 +146,26 @@ impl<'a> GraphExplorer<'a> {
}
pub fn execute_command(&mut self, command: &Commands) -> anyhow::Result<()> {
if let Commands::Archive = command {
if !self.get_current_path().is_empty() {
tracing::debug!("archiving path: {:?}", self.get_current_path())
match command {
Commands::Archive => {
if !self.get_current_path().is_empty() {
tracing::debug!("archiving path: {:?}", self.get_current_path())
}
}
Commands::CreateSection { name } => {
if !name.is_empty() {
let mut path = self.get_current_path();
path.push(name.replace(" ", "-").replace(".", "-"));
self.state.commander.execute(
hyperlog_core::commander::Command::CreateSection {
root: self.inner.root.clone(),
path,
},
)?;
}
}
_ => (),
}
self.update_graph()?;