feat: add archive sub command
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-06-01 13:13:18 +02:00
parent 710fb431f7
commit 9587c60e72
17 changed files with 232 additions and 43 deletions

View File

@@ -6,7 +6,7 @@ use ratatui::{prelude::*, widgets::*};
use crate::{
command_parser::Commands,
commands::{
batch::BatchCommand, create_item::CreateItemCommandExt,
archive::ArchiveCommandExt, batch::BatchCommand, create_item::CreateItemCommandExt,
create_section::CreateSectionCommandExt,
open_update_item_dialog::OpenUpdateItemDialogCommandExt, toggle_item::ToggleItemCommandExt,
update_graph::UpdateGraphCommandExt, Command, IntoCommand,
@@ -236,7 +236,19 @@ impl<'a> GraphExplorer<'a> {
match command {
Commands::Archive => {
if !self.get_current_path().is_empty() {
tracing::debug!("archiving path: {:?}", self.get_current_path())
batch.with(
self.state
.archive_command()
.command(
&self.inner.root,
&self
.get_current_path()
.iter()
.map(|i| i.as_str())
.collect_vec(),
)
.into_command(),
);
}
}
Commands::CreateSection { name } => {
@@ -244,13 +256,6 @@ impl<'a> GraphExplorer<'a> {
let mut path = self.get_current_path();
path.push(name.replace(".", "-"));
// self.state
// .commander
// .execute(commander::Command::CreateSection {
// root: self.inner.root.clone(),
// path,
// })?;
let cmd = self.state.create_section_command().command(
&self.inner.root,
&path.iter().map(|i| i.as_str()).collect_vec(),