diff --git a/etc/cli.yml b/etc/cli.yml index 1ab526a3..50ca507c 100644 --- a/etc/cli.yml +++ b/etc/cli.yml @@ -180,6 +180,37 @@ subcommands: required: true takes_value: true + - set_tags: + about: Set tags in bookmark(s) + version: 0.1 + author: Matthias Beyer + args: + - to_id: + long: to-id + help: Set tags in bookmark with this id + required: false + takes_value: true + + - to_match: + short: m + long: to-match + help: Set tags in bookmark(s) which match this regex + required: false + takes_value: true + + - to_tags: + long: to-tags + help: Set tags in bookmark(s) which have these tag(s) + required: false + takes_value: true + + - tags: + short: t + long: tags + help: Set these tags + required: true + takes_value: true + - todo: about: Todo module version: 0.1 diff --git a/src/module/bm/mod.rs b/src/module/bm/mod.rs index 0e5d783b..6644c59e 100644 --- a/src/module/bm/mod.rs +++ b/src/module/bm/mod.rs @@ -169,6 +169,12 @@ impl<'a> BM<'a> { }) } + fn command_set_tags(&self, matches: &ArgMatches) -> bool { + self.alter_tags_in_files(matches, |old_tags, cli_tags| { + cli_tags.clone() + }) + } + fn alter_tags_in_files(&self, matches: &ArgMatches, generate_new_tags: F) -> bool where F: Fn(Vec, &Vec) -> Vec { @@ -223,6 +229,7 @@ impl<'a> BM<'a> { .all(|x| x) } + fn get_files(&self, matches: &ArgMatches, id_key: &'static str, @@ -326,6 +333,10 @@ impl<'a> Module<'a> for BM<'a> { self.command_rm_tags(matches.subcommand_matches("rm_tags").unwrap()) }, + Some("set_tags") => { + self.command_set_tags(matches.subcommand_matches("set_tags").unwrap()) + }, + Some(_) | None => { info!("No command given, doing nothing"); false