tangled
alpha
login
or
join now
ngp.computer
/
tsk
A file-based task manager
0
fork
atom
overview
issues
pulls
pipelines
FIX: docstring for find output, change default
ngp.computer
1 year ago
c937ac0e
777d43ab
+8
-8
1 changed file
expand all
collapse all
unified
split
src
main.rs
+8
-8
src/main.rs
···
90
90
Find {
91
91
#[command(flatten)]
92
92
args: FindArgs,
93
93
-
/// Whether to print the full TSK-ID (instead of just an integer)
94
94
-
#[arg(short = 'F', default_value_t = true)]
95
95
-
full_id: bool,
93
93
+
/// Whether to print the a shortened tsk ID (just the integer portion). Defaults to *false*
94
94
+
#[arg(short = 'f', default_value_t = false)]
95
95
+
short_id: bool,
96
96
},
97
97
98
98
/// Prints the contents of a task, parsing the body as rich text and formatting it using ANSI
···
251
251
Commands::Edit { task_id } => command_edit(dir, task_id),
252
252
Commands::Completion { shell } => command_completion(shell),
253
253
Commands::Drop { task_id } => command_drop(dir, task_id),
254
254
-
Commands::Find { args, full_id } => command_find(dir, full_id, args),
254
254
+
Commands::Find { args, short_id } => command_find(dir, short_id, args),
255
255
Commands::Rot => Workspace::from_path(dir).unwrap().rot(),
256
256
Commands::Tor => Workspace::from_path(dir).unwrap().tor(),
257
257
Commands::Prioritize { task_id } => command_prioritize(dir, task_id),
···
373
373
Ok(())
374
374
}
375
375
376
376
-
fn command_find(dir: PathBuf, full_id: bool, find_args: FindArgs) -> Result<()> {
376
376
+
fn command_find(dir: PathBuf, short_id: bool, find_args: FindArgs) -> Result<()> {
377
377
let id = Workspace::from_path(dir)?.search(None, find_args.search_body, false)?;
378
378
if let Some(id) = id {
379
379
-
if full_id {
380
380
-
println!("{id}");
381
381
-
} else {
379
379
+
if short_id {
382
380
// print as integer
383
381
println!("{}", id.0);
382
382
+
} else {
383
383
+
println!("{id}");
384
384
}
385
385
} else {
386
386
eprintln!("No task selected.");