A file-based task manager

FIX: -T command flag parsing

+14 -5
+2
.tsk/archive/tsk-26.tsk
···
··· 1 + fix -T tsk-id parsing 2 +
+1 -1
.tsk/index
··· 1 tsk-21 Add command to setup git stuff 2 tsk-8 IMAP4-based sync 3 tsk-17 Add reopen command 4 tsk-16 Add ability to search archived tasks with find command 5 tsk-15 Add link identification to tasks 6 tsk-9 fix timestamp storage and parsing 7 - tsk-10 foreign workspaces 8 tsk-7 allow for creating tasks that don't go to top of stack 9 tsk-13 user-defined labels 10 tsk-18 Add reindex command
··· 1 + tsk-10 foreign workspaces 2 tsk-21 Add command to setup git stuff 3 tsk-8 IMAP4-based sync 4 tsk-17 Add reopen command 5 tsk-16 Add ability to search archived tasks with find command 6 tsk-15 Add link identification to tasks 7 tsk-9 fix timestamp storage and parsing 8 tsk-7 allow for creating tasks that don't go to top of stack 9 tsk-13 user-defined labels 10 tsk-18 Add reindex command
+1 -1
.tsk/next
··· 1 - 26
··· 1 + 27
+1
.tsk/tasks/tsk-26.tsk
···
··· 1 + ../archive/tsk-26.tsk
+1 -1
Cargo.lock
··· 590 ] 591 592 [[package]] 593 - name = "tsk" 594 version = "0.2.3" 595 dependencies = [ 596 "clap",
··· 590 ] 591 592 [[package]] 593 + name = "tsk-cli" 594 version = "0.2.3" 595 dependencies = [ 596 "clap",
+7 -2
src/main.rs
··· 10 use std::io::{self, Write}; 11 use std::path::PathBuf; 12 use std::process::exit; 13 use std::{env::current_dir, io::Read}; 14 use task::ParsedLink; 15 use workspace::{Id, TaskIdentifier, Workspace}; 16 17 //use smol; 18 //use iocraft::prelude::*; 19 - use clap::{value_parser, Args, CommandFactory, Parser, Subcommand}; 20 use edit::edit as open_editor; 21 22 fn default_dir() -> PathBuf { 23 current_dir().unwrap() 24 } 25 26 #[derive(Parser)] ··· 170 id: Option<u32>, 171 172 /// The ID of the task to select with the 'tsk-' prefix. 173 - #[arg(short = 'T', value_name = "TSK-ID", value_parser = value_parser!(String))] 174 tsk_id: Option<Id>, 175 176 /// Selects a task relative to the top of the stack.
··· 10 use std::io::{self, Write}; 11 use std::path::PathBuf; 12 use std::process::exit; 13 + use std::str::FromStr as _; 14 use std::{env::current_dir, io::Read}; 15 use task::ParsedLink; 16 use workspace::{Id, TaskIdentifier, Workspace}; 17 18 //use smol; 19 //use iocraft::prelude::*; 20 + use clap::{Args, CommandFactory, Parser, Subcommand}; 21 use edit::edit as open_editor; 22 23 fn default_dir() -> PathBuf { 24 current_dir().unwrap() 25 + } 26 + 27 + fn parse_id(s: &str) -> std::result::Result<Id, &'static str> { 28 + Ok(Id::from_str(s).map_err(|_| "Unable to parse tsk- ID")?) 29 } 30 31 #[derive(Parser)] ··· 175 id: Option<u32>, 176 177 /// The ID of the task to select with the 'tsk-' prefix. 178 + #[arg(short = 'T', value_name = "TSK-ID", value_parser = parse_id)] 179 tsk_id: Option<Id>, 180 181 /// Selects a task relative to the top of the stack.
+1
src/workspace.rs
··· 31 32 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { 33 let s = s 34 .strip_prefix("tsk-") 35 .ok_or(Self::Err::Parse(format!("expected tsk- prefix. Got {s}")))?; 36 Ok(Self(s.parse()?))
··· 31 32 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { 33 let s = s 34 + .trim() 35 .strip_prefix("tsk-") 36 .ok_or(Self::Err::Parse(format!("expected tsk- prefix. Got {s}")))?; 37 Ok(Self(s.parse()?))