def main():
    wf = Items()

    search_term = Tools.getArgv(1)
    locked_history_dbs = history_paths()
    results = list()
    if search_term is not None:
        results = get_histories(locked_history_dbs, search_term)
    else:
        sys.exit(0)
    if len(results) > 0:
        for i in results:
            url = i[0]
            title = i[1]
            visits = i[2]
            wf.setItem(title=title,
                       subtitle=f"(Visits: {visits}) {url}",
                       arg=url,
                       quicklookurl=url)
            wf.addItem()
    if wf.getItemsLengths() == 0:
        wf.setItem(
            title="Nothing found in History!",
            subtitle=f'Search "{search_term}" in Google?',
            arg=f"https://www.google.com/search?q={search_term}",
        )
        wf.addItem()
    wf.write()
wf = Items()
query = Tools.getArgv(1) if Tools.getArgv(1) is not None else str()
bms = paths_to_bookmarks()
fire_path = path_to_fire_bookmarks()

if fire_path:
    fire_bms = load_fire_bookmarks(fire_path)
    fire_bms = removeDuplicates(fire_bms)
    matches = match(query, fire_bms) if query != str() else fire_bms
    for ft, furl in matches:
        wf.setItem(title=ft, subtitle=furl, arg=furl, quicklook=furl)
        wf.addItem()

if len(bms) > 0:
    for bookmarks_file in bms:
        bm_json = get_json_from_file(bookmarks_file)
        bookmarks = get_all_urls(bm_json)
        matches = match(query, bookmarks)
        for m in matches:
            name = m[0]
            url = m[1]
            wf.setItem(title=name, subtitle=url, arg=url, quicklookurl=url)
            wf.addItem()

if wf.getItemsLengths() == 0:
    wf.setItem(title='No Bookmark found!',
               subtitle=f'Search "{query}" in Google...',
               arg=f'https://www.google.com/search?q={query}')
    wf.addItem()
wf.write()