diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2020-06-20 21:40:12 -0400 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2020-06-20 21:40:12 -0400 |
| commit | da1226901c244da02395fc9656051f8797d23800 (patch) | |
| tree | 7fc4e97385defbd23ff3a1d73a22013500e8b059 | |
| parent | a6bceb230159b18f24da579fcb990d5268bde1df (diff) | |
[birka-cli] add 'remove' command.
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | src/birka-cli.rs | 10 |
2 files changed, 18 insertions, 0 deletions
@@ -81,6 +81,14 @@ will be used. Alternatively, the `TB_PATH` environment variable can be specified, but `-o` takes a higher precedence. If neither are specified, "birka.db" in the current directory is used. +A few other things that can be done from the command-line: + +Removing an image can be done with 'remove'. + +```sh +$ birka-cli remove Cat.jpeg +``` + ### Web-Interface (API) The web interface for бирка-тян exposes a RESTful API for remotely interacting 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]); |