Source code for point.plugs.find

# p/plugs/find.py
#
#

## IMPORTS

from point.utils import format, txt_parse
from point import kernel

## basic

import threading
import logging
import time
import re

## find command 

[docs]def do_find(event): rest = event.get_rest() if not rest: return parsed = txt_parse(rest) objs = kernel.objects() cont = False uniq = [] for obj in sorted(objs, key=lambda x: x.timed): if "uniq" in parsed.wanted: key = parsed.wanted["uniq"] if key in obj: if obj[key] in uniq: cont = True else: uniq.append(obj[key]) if cont: cont = False ; continue if not obj.selector(parsed.args): continue if not obj.check_wanted(parsed.wanted): continue if obj.check_notwanted(parsed.not_wanted): continue obj.format = "values" res = format(obj, parsed.args) if res: event.reply(res)
kernel.cmnds.register("find", do_find)