A file-based task manager

FIX: remove task link on drop

+21 -5
+13
.tsk/archive/tsk-28.tsk
··· 1 + Add tool to clean up old tasks not in index 2 + 3 + Previously the `drop` command did not remove the symlink in .tsk/tasks when a 4 + task was dropped, only removing it from the index. I don't recall if this was 5 + because my original design expected the index to be the source of truth on 6 + whether a task was prioritized or not or if I simply forgot to add it. Either 7 + way, drop now properly removes the symlink but basically every existing 8 + workspace has a bunch of junk in it. I can write a simple script that deletes 9 + all symlinks that aren't present in the index. 10 + 11 + This does suggest that I should add a reindex command to add tasks that are not 12 + present in the index but are in the tasks folder to the index at the *bottom*, 13 + preserving the existing order of the index.
+1 -1
.tsk/index
··· 1 - tsk-27 Fix -F doc on find 1732997985 1 + tsk-28 Add tool to clean up old tasks not in index 1733166288 2 2 tsk-10 foreign workspaces 1732594198 3 3 tsk-21 Add command to setup git stuff 1732594198 4 4 tsk-8 IMAP4-based sync 1732594198
+1 -1
.tsk/next
··· 1 - 28 1 + 29
+1
.tsk/tasks/tsk-28.tsk
··· 1 + ../archive/tsk-28.tsk
+2 -2
Cargo.lock
··· 1 1 # This file is automatically @generated by Cargo. 2 2 # It is not intended for manual editing. 3 - version = 3 3 + version = 4 4 4 5 5 [[package]] 6 6 name = "anstream" ··· 591 591 592 592 [[package]] 593 593 name = "tsk-cli" 594 - version = "0.2.4" 594 + version = "0.2.5" 595 595 dependencies = [ 596 596 "clap", 597 597 "clap_complete",
+3 -1
src/workspace.rs
··· 10 10 use std::collections::{vec_deque, BTreeMap, HashSet}; 11 11 use std::ffi::OsString; 12 12 use std::fmt::Display; 13 - use std::fs::File; 13 + use std::fs::{remove_file, File}; 14 14 use std::io::{BufRead as _, BufReader, Read, Seek, SeekFrom}; 15 15 use std::ops::Deref; 16 16 use std::os::unix::fs::symlink; ··· 309 309 let id = self.resolve(identifier)?; 310 310 let mut stack = self.read_stack()?; 311 311 let index = &stack.iter().map(|i| i.id).position(|i| i == id); 312 + // TODO: remove the softlink in .tsk/tasks 312 313 let task = if let Some(index) = index { 313 314 let prioritized_task = stack.remove(*index); 314 315 stack.save()?; ··· 316 317 } else { 317 318 None 318 319 }; 320 + remove_file(self.path.join("tasks").join(format!("tsk-{}.tsk", id)))?; 319 321 Ok(task) 320 322 } 321 323