From da1226901c244da02395fc9656051f8797d23800 Mon Sep 17 00:00:00 2001 From: "Jakob L. Kreuze" Date: Sat, 20 Jun 2020 21:40:12 -0400 Subject: [birka-cli] add 'remove' command. --- src/birka-cli.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/birka-cli.rs b/src/birka-cli.rs index 6f588fa..abbd0d0 100644 --- a/src/birka-cli.rs +++ b/src/birka-cli.rs @@ -35,6 +35,7 @@ fn main() { println!("\t-o, --output [PATH]: Path to the tag database."); println!(); println!("\tACTION: add [PATH] [TAGS ...]: index an image, optionally tagged."); + println!("\tACTION: remove [PATH]: remove an image from the database."); println!("\tACTION: add_tags [PATH] [TAGS ...]: add tags to an indexed image."); println!("\tACTION: remove_tags [PATH] [TAGS ...]: remove tags from an indexed image."); println!("\tACTION: query [QUERY_STRING]: list images in the database."); @@ -72,6 +73,15 @@ fn main() { tb.add_file(&path, &args[3..].to_vec()).unwrap(); } + "remove" => { + if args.len() < 3 { + eprintln!("usage: {} remove PATH", args[0]); + std::process::exit(1); + } + + let file = tb.file_by_path(&args[2]).unwrap(); + tb.remove_file(file.id).unwrap(); + } "add_tags" => { if args.len() < 3 { eprintln!("usage: {} add_tags PATH [TAGS ...]", args[0]); -- cgit v1.3