import re


def parse_ddgr_at_line(line: str):
    """Parse lines of this form:

    alias @zdnet='ddgr -w zdnet.com'\n
    """
    tokens = line.strip().split()
    ddgr_at = tokens[-1][:-1]  # ignore "'" in the end of line
    plugin_name = ddgr_at.split(".")[0]
    res = re.search("@(.*)=", line)

    if res is None:
        trigger = None
    else:
        trigger = res.groups()[0]

    return plugin_name, ddgr_at, trigger