feat: add command for quickly creating an item
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -6,7 +6,8 @@ use ratatui::{prelude::*, widgets::*};
|
||||
use crate::{
|
||||
command_parser::Commands,
|
||||
commands::{
|
||||
batch::BatchCommand, create_section::CreateSectionCommandExt,
|
||||
batch::BatchCommand, create_item::CreateItemCommandExt,
|
||||
create_section::CreateSectionCommandExt,
|
||||
open_update_item_dialog::OpenUpdateItemDialogCommandExt, toggle_item::ToggleItemCommandExt,
|
||||
update_graph::UpdateGraphCommandExt, Command, IntoCommand,
|
||||
},
|
||||
@@ -241,7 +242,7 @@ impl<'a> GraphExplorer<'a> {
|
||||
Commands::CreateSection { name } => {
|
||||
if !name.is_empty() {
|
||||
let mut path = self.get_current_path();
|
||||
path.push(name.replace(" ", "-").replace(".", "-"));
|
||||
path.push(name.replace(".", "-"));
|
||||
|
||||
// self.state
|
||||
// .commander
|
||||
@@ -258,6 +259,21 @@ impl<'a> GraphExplorer<'a> {
|
||||
batch.with(cmd.into_command());
|
||||
}
|
||||
}
|
||||
Commands::CreateItem { name } => {
|
||||
if !name.is_empty() {
|
||||
let mut path = self.get_current_path();
|
||||
path.push(name.replace(".", " "));
|
||||
let cmd = self.state.create_item_command().command(
|
||||
&self.inner.root,
|
||||
&path.iter().map(|i| i.as_str()).collect_vec(),
|
||||
name,
|
||||
"",
|
||||
&hyperlog_core::log::ItemState::default(),
|
||||
);
|
||||
|
||||
batch.with(cmd.into_command());
|
||||
}
|
||||
}
|
||||
Commands::Edit => {
|
||||
if let Some(item) = self.get_current_item() {
|
||||
let path = self.get_current_path();
|
||||
|
Reference in New Issue
Block a user