tangled
alpha
login
or
join now
ngp.computer
/
tsk
A file-based task manager
0
fork
atom
overview
issues
pulls
pipelines
Add options for querying body, not implemented
ngp.computer
1 year ago
23b332da
9ba60f69
+20
-5
2 changed files
expand all
collapse all
unified
split
src
main.rs
workspace.rs
+12
-3
src/main.rs
···
162
162
Commands::Edit { task_id } => command_edit(dir, task_id),
163
163
Commands::Completion { shell } => command_completion(shell),
164
164
Commands::Drop => command_drop(dir),
165
165
-
Commands::Find { full_id, .. } => command_find(dir, full_id),
165
165
+
Commands::Find {
166
166
+
full_id,
167
167
+
search_body,
168
168
+
search_archived,
169
169
+
} => command_find(dir, full_id, search_body, search_archived),
166
170
Commands::Rot => Workspace::from_path(dir).unwrap().rot(),
167
171
Commands::Tor => Workspace::from_path(dir).unwrap().tor(),
168
172
Commands::Reprioritize { task_id } => command_reprioritize(dir, task_id),
···
267
271
Ok(())
268
272
}
269
273
270
270
-
fn command_find(dir: PathBuf, full_id: bool) -> Result<()> {
271
271
-
let id = Workspace::from_path(dir)?.search(None)?;
274
274
+
fn command_find(
275
275
+
dir: PathBuf,
276
276
+
full_id: bool,
277
277
+
search_body: bool,
278
278
+
search_archived: bool,
279
279
+
) -> Result<()> {
280
280
+
let id = Workspace::from_path(dir)?.search(None, search_body, search_archived)?;
272
281
if let Some(id) = id {
273
282
if full_id {
274
283
println!("{id}");
+8
-2
src/workspace.rs
···
66
66
67
67
impl Workspace {
68
68
pub fn init(path: PathBuf) -> Result<()> {
69
69
+
// TODO: detect if in a git repo and add .tsk/ to `.git/info/exclude`
69
70
let tsk_dir = path.join(".tsk");
70
71
if tsk_dir.exists() {
71
72
return Err(Error::AlreadyInitialized);
···
97
98
let stack_item = stack.get(r as usize).ok_or(Error::NoTasks)?;
98
99
Ok(stack_item.id)
99
100
}
100
100
-
TaskIdentifier::Find => self.search(None)?.ok_or(Error::NotSelected),
101
101
+
TaskIdentifier::Find => self.search(None, false, false)?.ok_or(Error::NotSelected),
101
102
}
102
103
}
103
104
···
224
225
}
225
226
}
226
227
227
227
-
pub fn search(&self, stack: Option<TaskStack>) -> Result<Option<Id>> {
228
228
+
pub fn search(
229
229
+
&self,
230
230
+
stack: Option<TaskStack>,
231
231
+
_search_body: bool,
232
232
+
_include_archived: bool,
233
233
+
) -> Result<Option<Id>> {
228
234
let stack = if let Some(stack) = stack {
229
235
stack
230
236
} else {