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
86
all: bool,
87
87
#[arg(short = 'c', default_value_t = 10)]
88
88
count: usize,
89
89
+
#[arg(short = 'i', default_value_t = false)]
90
90
+
ids: bool
89
91
},
90
92
91
93
/// Swaps the top two tasks on the stack. If there are less than 2 tasks on the stack, there is
···
253
255
Commands::Init => command_init(dir),
254
256
Commands::Push { edit, body, title } => command_push(dir, edit, body, title),
255
257
Commands::Append { edit, body, title } => command_append(dir, edit, body, title),
256
256
-
Commands::List { all, count } => command_list(dir, all, count),
258
258
+
Commands::List { all, count, ids } => command_list(dir, all, ids, count),
257
259
Commands::Swap => command_swap(dir),
258
260
Commands::Show {
259
261
task_id,
···
344
346
workspace.append_task(task)
345
347
}
346
348
347
347
-
fn command_list(dir: PathBuf, all: bool, count: usize) -> Result<()> {
349
349
+
fn command_list(dir: PathBuf, all: bool, only_print_ids: bool, count: usize) -> Result<()> {
348
350
let workspace = Workspace::from_path(dir)?;
349
351
let stack = workspace.read_stack()?;
350
352
···
358
360
.enumerate()
359
361
.take_while(|(idx, _)| all || idx < &count)
360
362
{
361
361
-
if let Some(parsed) = task::parse(&stack_item.title) {
362
362
-
println!("{}\t{}", stack_item.id, parsed.content.trim());
363
363
-
} else {
364
364
-
println!("{stack_item}");
363
363
+
match (task::parse(&stack_item.title), only_print_ids) {
364
364
+
(None, false) => {
365
365
+
println!("{stack_item}");
366
366
+
},
367
367
+
(Some(parsed), false) => {
368
368
+
println!("{}\t{}", stack_item.id, parsed.content.trim())
369
369
+
},
370
370
+
(None, true) | (Some(_), true) => {
371
371
+
println!("{}", stack_item.id)
372
372
+
},
365
373
}
366
374
}
367
375
Ok(())