summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2020-06-20 21:40:12 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2020-06-20 21:40:12 -0400
commitda1226901c244da02395fc9656051f8797d23800 (patch)
tree7fc4e97385defbd23ff3a1d73a22013500e8b059 /src
parenta6bceb230159b18f24da579fcb990d5268bde1df (diff)
[birka-cli] add 'remove' command.
Diffstat (limited to 'src')
-rw-r--r--src/birka-cli.rs10
1 files changed, 10 insertions, 0 deletions
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]);