tangled
alpha
login
or
join now
ngp.computer
/
tsk
A file-based task manager
0
fork
atom
overview
issues
pulls
pipelines
Compare changes
Choose any two refs to compare.
base:
tsk/30-flag-for-only-printing-ids
master
better-search
v0.4.0
compare:
tsk/30-flag-for-only-printing-ids
master
better-search
v0.4.0
go
+14
-6
1 changed file
expand all
collapse all
unified
split
src
main.rs
+14
-6
src/main.rs
···
86
all: bool,
87
#[arg(short = 'c', default_value_t = 10)]
88
count: usize,
0
0
89
},
90
91
/// Swaps the top two tasks on the stack. If there are less than 2 tasks on the stack, there is
···
253
Commands::Init => command_init(dir),
254
Commands::Push { edit, body, title } => command_push(dir, edit, body, title),
255
Commands::Append { edit, body, title } => command_append(dir, edit, body, title),
256
-
Commands::List { all, count } => command_list(dir, all, count),
257
Commands::Swap => command_swap(dir),
258
Commands::Show {
259
task_id,
···
344
workspace.append_task(task)
345
}
346
347
-
fn command_list(dir: PathBuf, all: bool, count: usize) -> Result<()> {
348
let workspace = Workspace::from_path(dir)?;
349
let stack = workspace.read_stack()?;
350
···
358
.enumerate()
359
.take_while(|(idx, _)| all || idx < &count)
360
{
361
-
if let Some(parsed) = task::parse(&stack_item.title) {
362
-
println!("{}\t{}", stack_item.id, parsed.content.trim());
363
-
} else {
364
-
println!("{stack_item}");
0
0
0
0
0
0
365
}
366
}
367
Ok(())
···
86
all: bool,
87
#[arg(short = 'c', default_value_t = 10)]
88
count: usize,
89
+
#[arg(short = 'i', default_value_t = false)]
90
+
ids: bool
91
},
92
93
/// Swaps the top two tasks on the stack. If there are less than 2 tasks on the stack, there is
···
255
Commands::Init => command_init(dir),
256
Commands::Push { edit, body, title } => command_push(dir, edit, body, title),
257
Commands::Append { edit, body, title } => command_append(dir, edit, body, title),
258
+
Commands::List { all, count, ids } => command_list(dir, all, ids, count),
259
Commands::Swap => command_swap(dir),
260
Commands::Show {
261
task_id,
···
346
workspace.append_task(task)
347
}
348
349
+
fn command_list(dir: PathBuf, all: bool, only_print_ids: bool, count: usize) -> Result<()> {
350
let workspace = Workspace::from_path(dir)?;
351
let stack = workspace.read_stack()?;
352
···
360
.enumerate()
361
.take_while(|(idx, _)| all || idx < &count)
362
{
363
+
match (task::parse(&stack_item.title), only_print_ids) {
364
+
(None, false) => {
365
+
println!("{stack_item}");
366
+
},
367
+
(Some(parsed), false) => {
368
+
println!("{}\t{}", stack_item.id, parsed.content.trim())
369
+
},
370
+
(None, true) | (Some(_), true) => {
371
+
println!("{}", stack_item.id)
372
+
},
373
}
374
}
375
Ok(())