Add filters to deactivate

This commit is contained in:
Tim Van Baak 2020-06-02 09:55:11 -07:00
parent a5e7dfd532
commit fac258e5f3
1 changed files with 8 additions and 0 deletions

View File

@ -44,6 +44,10 @@ def command_deactivate(args):
parser.add_argument("source", parser.add_argument("source",
nargs="*", nargs="*",
help="Cells to deactivate.") help="Cells to deactivate.")
parser.add_argument("--tag",
help="Only deactivate items with this tag")
parser.add_argument("--title",
help="Only deactivate items with titles containing this substring")
args = parser.parse_args(args) args = parser.parse_args(args)
if len(args.source) == 0: if len(args.source) == 0:
@ -62,6 +66,10 @@ def command_deactivate(args):
count = 0 count = 0
items, _ = load_items(source_name) items, _ = load_items(source_name)
for item in items.values(): for item in items.values():
if args.tag and args.tag not in item['tags']:
continue
if args.title and args.title not in item['title']:
continue
if item['active']: if item['active']:
item['active'] = False item['active'] = False
count += 1 count += 1