1
Fork 0
mirror of https://github.com/j1g5awi/krunner-vscode.git synced 2024-11-25 03:19:31 +00:00

Add command to test matching

This commit is contained in:
Jake Howard 2023-05-14 18:00:35 +01:00
parent 102abf38e1
commit d1f3e15b0a
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -2,6 +2,8 @@ import difflib
import json
import os
import sqlite3
import sys
from operator import attrgetter
from pathlib import Path
from typing import NamedTuple
@ -115,6 +117,16 @@ class Runner(dbus.service.Object):
os.system("xdg-open " + data)
runner = Runner()
loop = GLib.MainLoop()
loop.run()
def main():
runner = Runner()
if sys.argv[1:]:
# Manual search - useful for local testing
for match in sorted(runner.Match(sys.argv[1]), key=attrgetter("relevance")):
print(match.data, match.relevance)
else:
loop = GLib.MainLoop()
loop.run()
if __name__ == "__main__":
main()